I have an automation that will let me know if a door sensor has been triggered while my wife and I are out.
alias: ... Away Door Sensor
description: ""
trigger:
- platform: state
from: "off"
to: "on"
entity_id: binary_sensor.front_door
- platform: state
from: "off"
to: "on"
entity_id: binary_sensor.kitchen_window_l
- platform: state
from: "off"
to: "on"
entity_id: binary_sensor.kitchen_window_r
- platform: state
from: "off"
to: "on"
entity_id: binary_sensor.kitchen_door_main
- platform: state
from: "off"
to: "on"
entity_id: binary_sensor.kitchen_door_l
- platform: state
from: "off"
to: "on"
entity_id: binary_sensor.bedroom_door_left
- platform: state
from: "off"
to: "on"
entity_id: binary_sensor.bedroom_door_right
condition:
- condition: not
conditions:
- condition: state
entity_id: person.angelina
state: home
- condition: state
entity_id: person.nicholas
state: home
action:
- device_id: 99e4216c96314c7297bca8f0859d6e6f
domain: mobile_app
type: notify
message: Door sensor triggered
mode: single
How could I add into the automation which door was opened?
Is there a better way then to create a helper (resets after a few minutes) and if that helper is on then show that sensor?
And donβt use a device action. There are very limited in what you can do.
try this:
alias: ... Away Door Sensor
description: ""
trigger:
- platform: state
from: "off"
to: "on"
entity_id:
- binary_sensor.front_door
- binary_sensor.kitchen_window_l
- binary_sensor.kitchen_window_r
- binary_sensor.kitchen_door_main
- binary_sensor.kitchen_door_l
- binary_sensor.bedroom_door_left
- binary_sensor.bedroom_door_right
condition:
- condition: not
conditions:
- condition: state
entity_id: person.angelina
state: home
- condition: state
entity_id: person.nicholas
state: home
action:
- service: notify.mobile_app
data:
message: '{{ trigger.to_state.attributes.name }} sensor triggered'
mode: single
you can probably get rid of the βfrom:β as well unless your sensors go to some other state regularly (unavailable, unknown) before going to βonβ.