I use owntracks and the iOS app to track my location,
I use this for automations (e.g. when I’m home or not) but also to track my location on a map as per this example
I found that there are times when one of the trackers is not accurate enough and gives me an incorrect zone location.
To try and improve the reliability of my overall location I created a simple automation that gets the latest tracker status and posts it to an MQTT topic.
This works great and my home/not home location is so much better.
Only issue is that the tracker in location/lolo does not have any coordinates, only a status (home/away/zone name).
How would I go about copying the lat and lon from the trigger.to_state info and posting it so that HA recognises this as coordinates so I can display it on a map card?
this is my camera card:
I think you’d need to make a custom component that looks at zone names and populates the lat and longitude. I don’t think there is some simple “templating way” to complete this. I could be wrong though.
The custom component would be a copy of the generic platform with the extra zone searching & populating bs in the python code.
I just did something kind of similar and thought I’d share in case it sparks any thoughts for you.
I have a few different types of device trackers in place, but for the sake of simplicity I have them all report status via mqtt to a mqtt_json device tracker which I then use for all automations. My recent addition was the Google Maps Location Sharing device tracker, which holds latitude and longitude in the attributes. I created template sensors (not shown on front end) for each of these attributes, and then whenever one of these changes, I pull the current values from the Google Maps tracker attributes and publish to my mqtt_json tracker.
Certainly open to suggestions on better ways of doing this if anyone has them!
Thnaks @petro but that seems a bit overkill no?
I’m actually thinking now of posting to the existing owntracks topic and fake the source as if it came from owntracks.
All I’d need to do is find a way to post a json message with the same data as owntrack’s one? Would that work?
Yah, that should work because it’s an mqtt topic. It’s just that owntracks will override it at times. You could always create a third mqtt device tracker and do the same thing.