I’ve got a HA installed at my parents house. Now that they’re retired, they’re constantly traveling and I’d like to setup a notification when any of the doors are opened after being closed for a week. Below is the first pass I’ve taken at this but I’ve noticed it’s not working. My guess is that the conditional check will never be > 1 week because it inherently gets reset in order to trigger the automation.
In order to fix the issue described above, should make a new input_datetime that is set by an automation after 1 minute after any of the doors are opened and then update the notification automation to compare the week delta with that time?
alias: Door opened after a week - Telegram Alert
description: ''
trigger:
- platform: state
entity_id: binary_sensor.door_front
to: 'on'
from: 'off'
- platform: state
entity_id: binary_sensor.door_deck
to: 'on'
from: 'off'
- platform: state
entity_id: binary_sensor.door_basement
to: 'on'
from: 'off'
condition:
- condition: template
value_template: >-
{{ (as_timestamp(now()) -
as_timestamp(states.binary_sensor.door_front.last_changed)) > 604800 }}
action:
- service: telegram_bot.send_message
data:
...
mode: single