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

51 lines
1.3 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:
binary_sensor:
- state_topic: "polly/lastmsg"
name: "Last 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.amazon_polly_say
entity_id:
- media_player.livingroomCC
- media_player.entry_alarm_panel
- media_player.bedroom_alarm_panel
data:
message: >
<speak>
{{states.sensor.last_message.state}}
</speak>
cache: true
- service: input_boolean.turn_off
entity_id:
- input_boolean.lastmsg