I created a script that notifies me if someone opens a door or window while I’m away from home. The problem is that the automation triggers when I enter the house; it doesn’t immediately realize I wasn’t home. It shouldn’t activate in that case. I use the smartphone app and also the FritzBox tool for device tracking. How can I fix this?
triggers:
- entity_id:
- binary_sensor.aqara_door_cucina_contact
- binary_sensor.aqara_door_salotto_contact
- binary_sensor.aqara_door_ingresso_contact
to: 'on'
trigger: state
conditions: []
actions:
- delay: '00:00:15'
- if:
- condition: state
entity_id: person.tom
state: not_home
- condition: state
entity_id: person.elsa
state: not_home
then:
- action: notify.mobile_app_456
data:
title: Porta aperta
message: >-
{{ trigger.to_state.attributes.friendly_name }} si è aperta e non
c'è nessuno in casa!
- action: notify.mobile_app_123
data:
title: Porta aperta
message: >-
{{ trigger.to_state.attributes.friendly_name }} si è aperta e non
c'è nessuno in casa!
mode: single