I have two types of door sensors running well on my HA but would like my Google home to announce that I have left my garage door open. May I see your examples, please.
I have Sonoff Bridge and some door sensors & I also have Wyse door sensor that connects to the wyse module plugged into my RPI.
Garage door uses the Wyze door sensor ( starter kit )
- platform: template
sensors:
garage_door_currently_open:
friendly_name: Garage Door State
value_template: >-
{% if is_state('binary_sensor.vision_zg8101_garage_door_detector_sensor', 'on') %}
Open
{% else %}
Closed
{% endif %}
Then add the automation:
- id: garage_door_open_long
alias: Garage Door Open For Long Time
trigger:
- entity_id: sensor.garage_door_currently_open
platform: state
to: Open
for:
minutes: 10
action:
- service: notify.to_sms
data:
message: Garage Door Open for Longer Than 10 Minutes
- service: tts.picotts_remote_say
entity_id: media_player.mpd
data_template:
message: Garage has been opened for a long time
Obviously modify the sensor used in the sensor template and point to your own tts.
You could have put that binary sensor directly in the automation trigger. I don’t see the need for the seperate sensor at all. Especially as you could have applied a device class to it.
- id: garage_door_open_long
alias: Garage Door Open For Long Time
trigger:
- entity_id: binary_sensor.vision_zg8101_garage_door_detector_sensor
platform: state
to: 'on'
for:
minutes: 10
action:
- service: notify.to_sms
data:
message: Garage Door Open for Longer Than 10 Minutes
- service: tts.picotts_remote_say
entity_id: media_player.mpd
data_template:
message: Garage has been opened for a long time
You are right it is not necessary however my tilt sensor reports on/off instead of open/closed. I wanted open/closed in the GUI as it just makes things easier to understand at a glance when getting/using values.
Use customize to apply the garage door class to the binary sensor. You get nice icons and open / close states in the front end.
If the sensor is defined in yaml (rather than discovered, or created with the UI) you can add the device class directly to the binary sensor config instead of using customize.