Device tracker from script?

You should be able to just use the device_tracker.see service call in your script. The first time you do, it will create the entity by adding it to known_devices.yaml. From then on, it will update that device entry. At the minimum, you need the dev_id and the location_name. The dev_id is what the entity will be called in Home Assistant. So if you execute the service call with:

{"dev_id":"thisis", "location_name":"home"}

It will create an entity called device_tracker.thisis with a status of home. Future service calls with that dev_id will update the entity.

Here’s a full list of the supported parameters for device_tracker.see:

Hope this helps! This service call is not really documented in the Home Assistant documentation, but you can use it for just about any custom presence detection you want. I didn’t like the built in options and already had a customized presence setup using Tasker on my Android phone, from when I was using SmartThings. So when I switched to Home Assistant, I used this functionality to adapt my existing setup.

12 Likes