mike31
August 20, 2023, 1:46am
1
Two automations
1.) turn on like if motion is detected
2.) turn off light when motion is clear for 5 minutes using the for field.
Is this the correct way of doing it?
I’ve had a couple automations kick off that had a for statement of an hour and it was only like two minutes ???
francisp
(Francis)
August 20, 2023, 3:10am
2
That should do it.
What did your trace show ?
Arh
August 20, 2023, 7:00am
3
Have a look at blueprints, there are plenty of blueprints that cover this sort of thing.
mike31
August 20, 2023, 10:10am
4
Just learning about this for the first time.
This happen while in the room and the occupancy sensor was just triggered on a few minutes ago. So no way it was in a clear state for an hour.
Does the automation look correct?
Or Entity Controller in HACS, which is much more compact.
mike31
August 20, 2023, 12:37pm
6
This looks nice, but I want to understand how to write the automations natively and not depend on perhaps an integration breaking due to upgrades.
Blue prints or a manual automation like above seem like the less of the three from breaking due to upgrades.
francisp
(Francis)
August 20, 2023, 12:55pm
7
if you use
to: 'off'
in the trigger, it triggers from ‘on’, ‘unavailable’ and ‘unknown’ to ‘off’
better use
from: 'on'
to: 'off'
and I would not use for:
for anything more then a few minutes.
mike31
August 20, 2023, 2:10pm
8
Why? What reasons shouldn’t I?
francisp
(Francis)
August 20, 2023, 2:14pm
9
The drawback of using long periods of time in for
, is that its countdown is reset whenever Home Assistant restarts or automations are reloaded (if you compose/modify automations with the Automation Editor, the moment you click the Save button it will automatically reload all automations).
1 Like
Arh
August 20, 2023, 3:10pm
10
And the timer will also reset if the item becomes unavailable.
mike31
August 20, 2023, 4:29pm
11
Can you provide a better example of how to do this?
mike31
August 20, 2023, 10:09pm
13
After some YouTube videos, I have a question.
Can a timer be used twice at the same time? I assume not and I should have timer helpers created for every automation??
mike31
August 21, 2023, 9:10am
14
Here is what I’ve come up with… Thinking this will work just fine?
haberda
(Haberda)
August 21, 2023, 8:58pm
15
This was fixed in the release last November.
1 Like