mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 15:26:59 +00:00
Add missing discovery prefix on device tracker's MQTT topics (#36119)
This commit is contained in:
parent
f1c65904e3
commit
b8f43538fe
@ -205,27 +205,27 @@ You can use the command line tool `mosquitto_pub` shipped with `mosquitto` or th
|
||||
To create the device_tracker:
|
||||
|
||||
```bash
|
||||
mosquitto_pub -h 127.0.0.1 -t homeassistant/device_tracker/a4567d663eaf/config -m '{"state_topic": "a4567d663eaf/state", "name": "My Tracker", "payload_home": "home", "payload_not_home": "not_home"}'
|
||||
mosquitto_pub -h 127.0.0.1 -t homeassistant/device_tracker/a4567d663eaf/config -m '{"state_topic": "homeassistant/device_tracker/a4567d663eaf/state", "name": "My Tracker", "payload_home": "home", "payload_not_home": "not_home"}'
|
||||
```
|
||||
|
||||
To set the state of the device tracker to "home":
|
||||
|
||||
```bash
|
||||
mosquitto_pub -h 127.0.0.1 -t a4567d663eaf/state -m 'home'
|
||||
mosquitto_pub -h 127.0.0.1 -t homeassistant/device_tracker/a4567d663eaf/state -m 'home'
|
||||
```
|
||||
|
||||
To set the state of the device tracker to a named location:
|
||||
|
||||
```bash
|
||||
mosquitto_pub -h 127.0.0.1 -t a4567d663eaf/state -m 'location_name'
|
||||
mosquitto_pub -h 127.0.0.1 -t homeassistant/device_tracker/a4567d663eaf/state -m 'location_name'
|
||||
```
|
||||
|
||||
If the device supports GPS coordinates then they can be sent to Home Assistant by specifying an attributes topic (i.e. "json_attributes_topic") in the configuration payload:
|
||||
|
||||
- Attributes topic: `a4567d663eaf/attributes`
|
||||
- Attributes topic: `homeassistant/device_tracker/a4567d663eaf/attributes`
|
||||
- Example attributes payload:
|
||||
|
||||
Example message to be received at topic `a4567d663eaf/attributes`:
|
||||
Example message to be received at topic `homeassistant/device_tracker/a4567d663eaf/attributes`:
|
||||
|
||||
```json
|
||||
{
|
||||
@ -238,7 +238,7 @@ Example message to be received at topic `a4567d663eaf/attributes`:
|
||||
To create the device_tracker with GPS coordinates support:
|
||||
|
||||
```bash
|
||||
mosquitto_pub -h 127.0.0.1 -t homeassistant/device_tracker/a4567d663eaf/config -m '{"json_attributes_topic": "a4567d663eaf/attributes", "name": "My Tracker"}'
|
||||
mosquitto_pub -h 127.0.0.1 -t homeassistant/device_tracker/a4567d663eaf/config -m '{"json_attributes_topic": "homeassistant/device_tracker/a4567d663eaf/attributes", "name": "My Tracker"}'
|
||||
```
|
||||
|
||||
{% note %}
|
||||
@ -250,7 +250,7 @@ Using `state_topic` is optional when using `json_attributes_topic` to determine
|
||||
To set the state of the device tracker to specific coordinates:
|
||||
|
||||
```bash
|
||||
mosquitto_pub -h 127.0.0.1 -t a4567d663eaf/attributes -m '{"latitude": 32.87336, "longitude": -117.22743, "gps_accuracy": 1.2}'
|
||||
mosquitto_pub -h 127.0.0.1 -t homeassistant/device_tracker/a4567d663eaf/attributes -m '{"latitude": 32.87336, "longitude": -117.22743, "gps_accuracy": 1.2}'
|
||||
```
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user