I have an automation where a (group of) lights switch on on sunset.
Also, there is an automation when a motion sensor does not sense motion for 30 minutes, the light turns off.
Works fine.
However, if I am not at home, the light goes on at sunset, but the motion sensor never triggers. The lights stay on all night.
How can I add a condition to the sunset condition that the light only switches on if there has been a motiondetection in the past 30 minutes?
Example from the docs
but i agree with @Burningstone
person presence would be more logical. As your not relying on a motion sensor having been or not having been triggered. + there’s usually more than one of you in the person presence.
condition:
condition: state
entity_id: device_tracker.paulus
state: 'not_home'
# optional: trigger only if state was this for last X time.
for:
hours: 1
minutes: 10
seconds: 5
Ah, yes, sure. Used Unifi for presence detection (wifi) but it resulted in lights switching off and on when my phone connects from 2.4Ghz to 5Ghz and the other way around. Used Owntracks, but is does not work reliable and often too slow; already home for half an hour but Owntracks thinks I’m still 50km away.
I’ve been googling for a reliable presence detection but have not (yet) found it. The best way would be to see if a hwaddr/mac is available on the net regardsless the connection.
I use small BLE tags and multiple PI Zero W around the house for presence detection (and even room detection) and it worked flawless in the last 2 years.
I would really suggest to figure out reliable presence detection for your system, as it is one of the core things of home automation in my opinion.
If you still want to go the motion detection way, I would suggest adding template conditions to your sunset automation, which check if the motion sensors “last changed” attribute is < 30 minutes.
As a solution to your posted topic using the presence condtion would be more wise.
Regarding using presence for triggering automations. Well only if you have it configure and implemented correctly.