mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-09 18:36:51 +00:00
Update sensor.mqtt.markdown for JSON attributes topic (#7851)
* Update sensor.mqtt.markdown * Update sensor.mqtt.markdown
This commit is contained in:
parent
42f38121b6
commit
e2c6972a0d
@ -78,9 +78,13 @@ payload_not_available:
|
||||
required: false
|
||||
type: string
|
||||
default: offline
|
||||
json_attributes_topic:
|
||||
description: The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes.
|
||||
required: false
|
||||
type: string
|
||||
json_attributes:
|
||||
description: A list of keys to extract values from a JSON dictionary payload and then set as sensor attributes.
|
||||
reqired: false
|
||||
description: (Deprecated, replaced by json_attributes_topic) A list of keys to extract values from a JSON dictionary payload and then set as sensor attributes.
|
||||
required: false
|
||||
type: list, string
|
||||
unique_id:
|
||||
description: "An ID that uniquely identifies this sensor. If two sensors have the same unique ID, Home Assistant will raise an exception."
|
||||
@ -126,9 +130,9 @@ device:
|
||||
|
||||
In this section you find some real-life examples of how to use this sensor.
|
||||
|
||||
### {% linkable_title JSON attributes configuration %}
|
||||
### {% linkable_title JSON attributes topic configuration %}
|
||||
|
||||
The example sensor below shows a configuration example which uses JSON in the state 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 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 %}.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
|
Loading…
x
Reference in New Issue
Block a user