I am on the progress of installing window(door) sensors, and I wanted to easily check if the window state change is registered to HA correctly.
So I had my Google home mini announce “Window is open” or “Window is closed” when there is a state change. Much better than staring into the lovelace UI while adjusting and testing the location of reed sensors.
In some cases the state change from “unknown” to “on” seemed to also triggered the automation, so I had to specifically assign both from and to values.
trigger.id
variable is used to make the TTS message variable.
blueprint:
name: Window Change Announce
description: Announce status change of window on speaker
domain: automation
input:
window_id:
name: Window Entity ID
description: entity_id of door sensor (binary_sensor)
selector:
entity:
domain: binary_sensor
device_class: window # Change to door if necessary, or delete this line
speaker_id:
name: Speaker Entity ID
description: entity_id of speaker (media_player)
selector:
entity:
domain: media_player
trigger:
- platform: state
entity_id: !input window_id
from: "on"
to: "off"
id: close
- platform: state
entity_id: !input window_id
from: "off"
to: "on"
id: open
action:
service: tts.google_translate_say
data:
entity_id: !input speaker_id
message: >
'Window is {{ trigger.id }}'