Hello
I want to have an automation which warns me when a sensor changes his state.
I see that the trigger works but I have no action.
Can someone help me and correct the automation?
Thanks
- alias: ketel alarm
trigger:
- platform: state
entity_id: binary_sensor.ketel
state: 'on'
- platform: state
entity_id: binary_sensor.ketel
state: 'off'
action:
service_template: >
{% if trigger.to_state.state == "on" %}
- service: shell_command.run_sudo
data:
cmd: 'mpg123 -q /home/pi/sound/chime.mp3'
- service: tts.google_say
data:
message: 'Hello Master, the heating is on.'
{% elif trigger.to_state.state == "off" %}
- service: shell_command.run_sudo
data:
cmd: 'mpg123 -q /home/pi/sound/chime.mp3'
- service: tts.google_say
data:
message: 'Hello Master, thanks for turning the heating is off.'
{% endif %}