I have a device tracker for my car (from bmw connected drive integration) and I would like to detect when the car is parked. My idea was to detect when the device tracker is not changing the position for a certain time but I’m not sure it is feasible or not.
I can check when the device tracker was updated but it’s not really the same. If something else that gps location changes it will also be considered as an update.
What would you do to detect that the car is parked ?
So what else do you expect should change the sensor ?
Alternative is to store the lat/lon in a separate sensor and check if changed a certain %, this as the gps is also not stable, even when the device is static…
I think the problem is that the device tracker received updates even the car is not moving.
For instance the car got parked more than one hour ago but the last change and last update was from 5 minutes ago.
I like the idea to check if the lat/lon change more than a certain %. Any idea how to do that in an automation (would like to use it as a trigger) ?
I quickly checked and I think it is usefull to know the distance or the proximity of something. I don’t think it would be able to detect when it is not moving (when it’s parked), is it ?
I would create a template input helper / sensor that states ‘moving’ if its own value (via attribs) are different from the source (device) and then update it also the attribs.
Something alike : device lat/lon updates > sensor gets triggered via the template, if diff more than x% then update
Mine currently returns a state attribute dir_of_travel with a value of stationary
It’s not something I’m currently tracking but for a car I would expect it to be reasonably responsive.
EDIT: The last_changed sensor attribute on my sensor indicates no change since my arrival at work (within 1 minute of my actual arrival) so it should be suitable.
Could be … or not … as you may have seen there are plenty of posts with device_tracker issues and myself I have 3 phones that behave oddly irregular, even when in the same location.
But, no question that your proposal to use proximity is a good and simple solution provided the device has good data
I think it could be useful.
If you set the zone to be home and the unit of measurement to km (or miles) then it should be static when the car is stationary.
That means you could have an automation or triggered sensor to trigger on state of the distance sensor with noting in to and from, but for: 1 minute.
That means as long as you are driving the distance changes and this means the automation does not trigger.
When you park the unit of measurement will be large enough to swallow any GPS jitter and thus making the sensor static for the required time to trigger the automation.