Home-AssistantConfig/config/packages/triggers/last_message.yaml

56 lines
1.4 KiB
YAML
Executable File

#-------------------------------------------
# @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
#-------------------------------------------
mqtt:
sensor:
- state_topic: "polly/lastmsg"
name: "Last Message"
- state_topic: "polly/lastmsg_openai"
name: "Last AI Message"
##############################################################################
### 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: >-
{{states.sensor.last_ai_message.state}}
cache: false
- service: input_boolean.turn_off
entity_id:
- input_boolean.lastmsg