I’m a little lost I’ve got a GPS tracker of which I can import it’s states through the RESTfull sensor integration. Either as one entity with multiple attributes or as multiple separate sensors.
Question 1
I want to create a device_tracker to be able to display it on the map. But how would I do this? I can’t find any recent working docs about this.
Question 2
Also I would appreciate some insight on tactics. When I started I had the the following goal. When the device enters the geofence of home, than turn on the porch light. Or if the device leaves the geofence of home after 23.00, then send notification. (unusual behavior, might be theft)
I did not realize using an external REST API would not give me realtime data. I don’t want to have a too small interval and flood the source. (It’s not an official integration)
Also, I have no idea of the interval of the tracker and its host. And, as far as I know I won’t get push notifications from the/a REST API.
Ok, as for this question. Is this approach unfit to real-time turn on the porch light at arrival of home? Or in other words, to have ad-hoc automatons? Or, how to do this better?
You can show ‘any’ sensor/entity on the map as long as it has attributes latitude and longitude
Seems so, you would want to have HA poll for changed location or pushed for it. REST in this case would need a frequency that is (as you already wrote) useless for 99.9% of the time. I assume that you get the data from a cloud/web/etc. env…no other options here, e.g. integrate with something else that integrates with HA?
Ah, thanks for the pointer. I’ll look for the docs to get this working.
Correct, the service is not an open API (thanks Postman). So there are no docs. This is why I want to keep the polling under the radar
Hmm two thoughts then. I should figure out the update interval on the REST Server side. (no need to update more frequent than it’s own internal frequency). And maybe I can change and set the interval of my REST requests by software. (Thought, maybe two different time trigger automations to populate a sensor. One 10 sec, one 5 minute. Then toggle after the first new state change to the faster trigger. When idle for 10 min, toggle back to slower trigger. This way the biggest delay is max 10 min. But with fast trigger I can turn porch light on and keep polling in balance.)
If you do need it to be an actual device tracker, there’s currently no regular template for it. But you can either use the MQTT integration to create one, or create one by editing known_devices.yaml. The latter is being deprecated (for a couple of years now, so it may stay a while yet). From thereon you can use the sevice_tracker.see service to set the location. Adding mqtt to your searches will probably lead you to the topics that are there.
By the way, I do not know what the source is, but if it can do mqtt that would be a great way to push the data to HA instead of pull.