Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 19 additions & 34 deletions source/_integrations/device_tracker.mqtt.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,27 @@ json_attributes_template:
required: false
type: template
json_attributes_topic:
description: "The MQTT topic subscribed to receive a JSON dictionary message containing device tracker attributes.
This topic can be used to set the location of the device tracker under the following conditions:
description: "The MQTT topic is subscribed to receive a JSON dictionary containing device tracker attributes and is used to update the location of the device tracker.\n
The JSON message must include either:\n

- If the attributes in the JSON message include `longitude`, `latitude`, and `gps_accuracy` (optional).\n
- If the device tracker is within a configured [zone](/integrations/zone/).\n
- `in_zones`, **or**\n
Comment thread
c0ffeeca7 marked this conversation as resolved.
- `longitude`, `latitude`, and optionally `gps_accuracy`.
Comment thread
jbouwh marked this conversation as resolved.

If these conditions are met, it is not required to configure `state_topic`.\n\n
Be aware that any location message received at `state_topic` overrides the location received via `json_attributes_topic` until a message configured with `payload_reset` is received at `state_topic`. For a more generic usage example of the `json_attributes_topic`, refer to the [MQTT sensor](/integrations/sensor.mqtt/#json-attributes-topic-configuration) documentation."
A device tracker is considered to be located *within a zone* when the `in_zones` attribute is provided.\n

You can provide location information in one of two ways:\n
Comment thread
c0ffeeca7 marked this conversation as resolved.

1. **Coordinates** — by including `longitude`, `latitude`, and optionally `gps_accuracy`.\n
2. **Zone reference** — by setting `in_zones` to the zone’s `friendly_name`, `object_id`, or `entity_id`.\n
Comment thread
c0ffeeca7 marked this conversation as resolved.

The `in_zones` attribute may be a single string or a list of strings.
Each value must match a Home Assistant zone’s `entity_id`, `object_id`, or `friendly_name`.\n
For example, the default zone with entity_id `zone.home` typically has:\n

- `friendly_name`: **Home** (depending on language settings and customization)\n
- `object_id`: **home**\n
Comment thread
c0ffeeca7 marked this conversation as resolved.

For a more general usage example of `json_attributes_topic`, refer to the [MQTT sensor](/integrations/sensor.mqtt/#json-attributes-topic-configuration) documentation."
required: false
type: string
name:
Expand All @@ -159,26 +172,6 @@ payload_available:
required: false
type: string
default: online
payload_home:
description: The payload value that represents the 'home' state for the device.
required: false
type: string
default: home
payload_not_available:
description: The payload that represents the unavailable state.
required: false
type: string
default: offline
payload_not_home:
description: The payload value that represents the 'not_home' state for the device.
required: false
type: string
default: not_home
payload_reset:
description: The payload value that will have the device's location automatically derived from Home Assistant's zones.
required: false
type: string
default: '"None"'
platform:
Comment thread
jbouwh marked this conversation as resolved.
Comment thread
jbouwh marked this conversation as resolved.
description: Must be `device_tracker`. Only allowed and required in [MQTT auto discovery device messages](/integrations/mqtt/#device-discovery-payload).
required: true
Expand All @@ -192,18 +185,10 @@ source_type:
description: Attribute of a device tracker that affects state when being used to track a [person](/integrations/person/). Valid options are `gps`, `router`, `bluetooth`, or `bluetooth_le`.
required: false
type: string
state_topic:
description: The MQTT topic subscribed to receive device tracker state changes. The states defined in `state_topic` override the location states defined by the `json_attributes_topic`. This state override is turned inactive if the `state_topic` receives a message containing `payload_reset`. The `state_topic` can only be omitted if `json_attributes_topic` is used. An empty payload is ignored. Valid payloads are `not_home`, `home` or any other custom location or zone name. Payloads for `not_home`, `home` can be overridden with the `payload_not_home`and `payload_home` config options.
required: false
type: string
unique_id:
description: "An ID that uniquely identifies this device_tracker. If two device_trackers have the same unique ID, Home Assistant will raise an exception. Required when used with device-based discovery."
required: false
type: string
Comment thread
jbouwh marked this conversation as resolved.
value_template:
description: "Defines a [template](/docs/templating/where-to-use/#mqtt) that returns a device tracker state."
required: false
type: template
{% endconfiguration %}

## Examples
Expand Down