mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-15 21:36:52 +00:00
Update example for JSON attributes topic (#8299)
This commit is contained in:
parent
20e8219367
commit
cdb4cfae6b
@ -132,7 +132,7 @@ In this section you find some real-life examples of how to use this sensor.
|
||||
|
||||
### {% linkable_title JSON attributes topic configuration %}
|
||||
|
||||
The example sensor below shows a configuration example which uses a JSON dict: `{"ClientName": <string>, "IP": <string>, "MAC": <string>, "RSSI": <string>, "HostName": <string>, "ConnectedSSID": <string>}` in a separate topic to add extra attributes. It also makes use of the `availability` topic. Attributes can then be extracted in [Templates](/docs/configuration/templating/#attributes). For example, to extract the `ClientName` attribute from the sensor below, use a template similar to: {% raw %}`{{ state_attr('sensor.bs_rssi', 'ClientName') }}`{% endraw %}.
|
||||
The example sensor below shows a configuration example which uses a JSON dict: `{"ClientName": <string>, "IP": <string>, "MAC": <string>, "RSSI": <string>, "HostName": <string>, "ConnectedSSID": <string>}` in a separate topic `home/sensor1/attributes` to add extra attributes. It also makes use of the `availability` topic. Extra attributes will be displayed in the frontend and can also be extracted in [Templates](/docs/configuration/templating/#attributes). For example, to extract the `ClientName` attribute from the sensor below, use a template similar to: {% raw %}`{{ state_attr('sensor.bs_rssi', 'ClientName') }}`{% endraw %}.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@ -146,13 +146,7 @@ sensor:
|
||||
availability_topic: "home/sensor1/status"
|
||||
payload_available: "online"
|
||||
payload_not_available: "offline"
|
||||
json_attributes:
|
||||
- ClientName
|
||||
- IP
|
||||
- MAC
|
||||
- RSSI
|
||||
- HostName
|
||||
- ConnectedSSID
|
||||
json_attributes_topic: "home/sensor1/attributes"
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user