#------------------------------------------- # @CCOSTAN # Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig #------------------------------------------- homeassistant: customize: input_boolean.lastmsg: friendly_name: 'Repeat Message' icon: mdi:repeat-once #------------------------------------------- input_boolean: lastmsg: name: Last Message initial: off #------------------------------------------- template: - trigger: platform: event event_type: openai_instructions_sent sensor: - name: "openai_instructions" unique_id: openai_instructions state: "on" attributes: instructions: "{{ trigger.event.data.instructions }}" - trigger: platform: event event_type: openai_response sensor: - name: "openai_response" unique_id: openai_response state: "on" attributes: response: "{{ trigger.event.data.response }}" ############################################################################## ### Automations - ############################################################################## automation: - alias: 'Repeat Last Message' id: a57b487c-e7dd-440e-b78b-08704ded8458 trigger: - platform: state entity_id: input_boolean.lastmsg to: 'on' action: - service: tts.cloud_say entity_id: - media_player.livingroomCC # - media_player.entry_alarm_panel # - media_player.bedroom_alarm_panel data: options: voice: JennyNeural message: >- "{{ state_attr('sensor.openai_response', 'response') }}" cache: false - service: input_boolean.turn_off entity_id: - input_boolean.lastmsg