I automated a scene that triggered when I arriving at home using locative.
But what I looking for how I can make a trigger only when I come from work to home (both configured in ha)
I mean how I can make a condition that will calculate the time I left the work?
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
You could also set up work and home as zones and use a zone trigger. Zone triggers can trigger when an entity is entering or leaving the zone. For zone automation to work though, you need to have setup a device tracker platform that supports reporting GPS coordinates.
I’m using locative and want to execute the script only in case when I go from work to home. That’s mean I need to calculate the time between status changed from ‘not_home’ to ‘home’ and time of ‘work’ changed to ‘not_home’. If this time is less than 30 minutes, fire the script.