So i am trying to get this automation to work but i am struggling. My google home announces it the first time but I can’t get it to repeat with the second script. Am i missing something?
alias: Water Alert TTS
sequence:
- service: tts.google_say
entity_id: media_player.living_room_home
data_template:
message: >
{% if state.(sensor.water_heater_water_sensor_flood) | float > 1 %}
Your basement has water in it. Go check it out now
{% elif state.(sensor.sump_pump_water_sensor_flood) | float > 1 %}
Your Sump Pump is broken in the basement
{% elif state.(sensor.laundry_room_water_sensor_flood) | float > 1 %}
Your laundry room has water in it. Go check it out now
{% else %}
Something water sensor has tripped but I cannot pinpoint where.
{% endif %}
- service: script.turn_on
entity_id: script.loop_water_alert
2nd Script
alias: Loop Water Alert TTS
sequence:
- delay:
# Delay for voice
seconds: 5
- condition: state
entity_id: input_boolean.water_alert
state: 'on'
- service: script.turn_on
entity_id: script.water_alert_tts
So I got a little closer. There was some things wrong in that first post. I guess I have been trying too many things. It appears that it will run the automation ok but never goes into the script to run.
alias: Water Alert TTS
sequence:
- service: tts.google_say
entity_id: media_player.living_room_home
data_template:
message: >
{% if state.(sensor.water_heater_water_sensor_flood) | float > 1 %}
Your basement has water in it. Go check it out now
{% elif state.(sensor.sump_pump_water_sensor_flood) | float > 1 %}
Your Sump Pump is broken in the basement
{% elif state.(sensor.laundry_room_water_sensor_flood) | float > 1 %}
Your laundry room has water in it. Go check it out now
{% else %}
Something water sensor has tripped but I cannot pinpoint where.
{% endif %}
- service: script.turn_on
entity_id: script.loop_water_alert
2nd Script
alias: Loop Water Alert
sequence:
- delay:
# Delay for voice
seconds: 5
- condition: state
entity_id: input_boolean.water_alert
state: 'on'
- service: script.turn_on
entity_id: script.water_alert_tts
So i tried it all three of these ways and none of them work. I must be missing something. I know it is executing the automation because I can hear the google home beep.
I couldn’t get your data template to work in dev tools, however if it’s like this it works…
{% if states.sensor.bedmaxtemp.state | float > 1 %}
Your basement has water in it. Go check it out now
{% elif states.sensor.bedmintemp.state | float > 1 %}
Your Sump Pump is broken in the basement
{% else %}
Something water sensor has tripped but I cannot pinpoint where.
{% endif %}
Obviously I’ve used my own sensors
As for the scripts, mine work either way that I posted, however I don’t think you can mix and match. I think if you use script.turn_on you need the data part and if you use the service call directly you don’t add enitity_id below it.