I would like to setup a single automation that will tell me which of my doors is open in the body of the notification message. Is there any way to do this?
For Instance if my garage door is open more than 10 minutes I want to be able to get a notification that says
The (garage door) is open. Or The (Front Door) is open. Using the same automation under triggers for all of the doors I have in my house…
using state triggers is more compact and they are easier to maintain if the devices themselves ever need replaced.
and then you can add id’s to the triggers and the actions become more compact.
the only downside (which really isn’t) is that you need to use templates in the actions.
so…
- id: '1667862723183'
alias: Notifications
description: ''
trigger:
- platform: state
entity_id: lock.front_door_lock
id: lock
to: unlocked
for:
minutes: 3
- platform: state
entity_id:
- binary_sensor.house_garage_door
- binary_sensor.garage_door
to: 'on'
for:
minutes: 3
action:
- if:
- condition:
id: lock
then:
- service: notify.notify
data:
message: Front Door is Unlocked
else:
- service: notify.notify
data:
message: {{ trigger.to_state.attributes.friendly_name}} is Open
mode: single
the only thing I’m not sure about is what the state of locks are since I don’t have any. I assume it’s locked/unlocked but if not you’ll have to fix that part.