Hi everybody,
I have set up a custom mqtt device tracker in Home Assistant. I have build a little nodejs application that pings the device and sends a mqtt message to home assistant with the updated location info.
However, Home Assistant doesn’t recognize if the device is in one of the “zones” created in Home Assistant. It only shows “home” and “away”
Problem is, I can only send a “home” or “not_home” payload as the device state. Even though I also send attributes containing the lat/lon coordinates and the device is displayed on the map in one of the zones, it will always show as “home” or “away”.
Integrated device trackers (like the companion app) show the current zone as the device tracker state, if I am, for example, at work.
Some context:
This is the discovery payload I sent to create the device tracker:
# homeassistant/device_tracker/xplora_x5_play/config
{
"name": "Xplora X5 Play",
"state_topic": "homeassistant/device_tracker/xplora_x5_play/state",
"availability_topic": "homeassistant/device_tracker/xplora_x5_play/availability",
"json_attributes_topic": "homeassistant/device_tracker/xplora_x5_play/attributes",
"payload_home": "home",
"source_type": "gps",
"unique_id": "xplora_x5_play"
}
This is the message to update attributes:
# homeassistant/device_tracker/xplora_x5_play/attributes
{
"latitude": "44.232021",
"longitude": "19.722266",
"address": "[redacted]",
"city": "[redacted]",
"battery": 36,
"charging": false,
}