Hello,
Just got a Google mini, I want to know how to announce which door is open in the below automation. i have tried reading about data template, but it seems to not work.
Summary: It basically checks if either doors are open at night and turn on a light and gives an audio message.
Thanks
- id: '1607323316101'
alias: ' Notification - Night Doors'
description: If door open late night, notify
trigger:
- platform: state
entity_id: binary_sensor.front_door_sensor
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.back_door_sensor
from: 'off'
to: 'on'
condition:
- condition: time
after: '22:00'
before: 06:00
action:
- type: turn_on
device_id: 153764e9087d11ebb1d2873a761d19ae
entity_id: switch.ceiling_light
domain: switch
- service: tts.cloud_say
data:
entity_id: media_player.googlehome
message: The door is Open!
cache: false
- delay: 00:15:00
- type: turn_off
device_id: 153764e9087d11ebb1d2873a761d19ae
entity_id: switch.ceiling_light
domain: switch
mode: single
- id: '1607323316101'
alias: ' Notification - Night Doors'
description: If door open late night, notify
trigger:
- platform: state
entity_id: binary_sensor.front_door_sensor
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.back_door_sensor
from: 'off'
to: 'on'
condition:
- condition: time
after: '22:00'
before: 06:00
action:
- type: turn_on
device_id: 153764e9087d11ebb1d2873a761d19ae
entity_id: switch.ceiling_light
domain: switch
- service: tts.google_say
data:
entity_id: media_player.shemin_bedroom_speaker
message: >-
{% if is_state("binary_sensor.front_door_sensor", "on") -%} The Front
door is open. {%- else -%} The back door is open. {%- endif %}
cache: false
- delay: 00:15:00
- type: turn_off
device_id: 153764e9087d11ebb1d2873a761d19ae
entity_id: switch.ceiling_light
domain: switch
mode: single
message: >-
{% if is_state("binary_sensor.front_door_sensor", "on") and
is_state("binary_sensor.back_door_sensor", "on") -%} The Front and back
doors are open. {%- elif is_state("binary_sensor.front_door_sensor",
"on") -%} The front door is open. {%- else -%} The back door is open. {%-
endif %}