I have a system/project where an automation is triggered every 2 minutes. It has conditions that limits the automation to only running when I am away from home.
The automation updates my phone GPS location and then pushes the data into a traccar server using a REST api
I do need the automation to run regularly when away from home but only if I am driving so I am trying to come up with a better (more efficient way).
I have a created sensors that calculates ‘speed’ and another one that hold the ‘age’ of last GPS location data but I am struggling to work out a way to use either of these sensors to improve the automation so that fires only when:
way from home (using a device_tracker)
GPS data is older than 60 secs
current speed > 5kmh
The issue I have at the moment is that GPS data is polled from my phone every 2 mins the entire time I am away from home but I want it to only do regular updates when I am driving (> 5kmh).
The Home Assistant companion app (Android and - I assume - iOS) opens up availability of an array of sensors that could be useful. This includes presence of Android Auto, bluetooth connection status, charging status, etc. These could potentially reveal if you are in your car.
I wish people would include actual details of their sensors: IDs, states, units etc. Here’s an attempt with made-up substitutes — it’s the usual “trigger off any of them, check all of them” pattern that runs the action as soon as all three become true:
Thank you and apologies. I have something similar but the issue with all triggers being true at the same time is problematic due to the circular nature of calculating speed (as it needs GPS data do do it). I think this is the ‘real’ problem I need to solve.
here is the yaml for my main automation - that works but it is caning my mobile battery when I am away and not driving. So I think I need a a way to detect ‘driving’ somehow.