123
(Taras)
September 8, 2023, 9:37pm
41
When the following is used in the automation’s action
section, it will get the latest value of last_triggered
.
state_attr('automation.presence_home_mode_home_away', 'last_triggered')
If you recall from my explanation above, last_triggered
is updated before executing the action
section.
flyize
September 8, 2023, 10:04pm
42
I think I understand that. Any reason my template above wouldn’t work?
last_triggered < 2 seconds
OR
last_triggered > 5 minutes
123
(Taras)
September 8, 2023, 10:28pm
43
See the explanation in my previous post.
flyize
September 9, 2023, 1:08pm
44
I’m still missing something. Yes, I understand last_triggered gets updated before the action section. That’s why I suggested that my template conditional be true if last_triggered < 2 seconds or last_triggered > 5 minutes.
Am I still missing something?
123
(Taras)
September 9, 2023, 1:44pm
45
I suggest you try what you proposed and observe the result.
The automation’s trace may be useful to understand its behavior.
stevland
(Stevland Ambrose)
November 20, 2023, 12:08am
46
This came in handy for my application, but I believe the last line should be:
datetime: "{{ now() + timedelta(hours = 1) }} "