From e2c6972a0d649a3156db809d4e9af0a9c612b28a Mon Sep 17 00:00:00 2001 From: emontnemery Date: Mon, 17 Dec 2018 20:36:48 +0100 Subject: [PATCH] Update sensor.mqtt.markdown for JSON attributes topic (#7851) * Update sensor.mqtt.markdown * Update sensor.mqtt.markdown --- source/_components/sensor.mqtt.markdown | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/_components/sensor.mqtt.markdown b/source/_components/sensor.mqtt.markdown index f29e5299776..4b87fc0521a 100644 --- a/source/_components/sensor.mqtt.markdown +++ b/source/_components/sensor.mqtt.markdown @@ -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": , "IP": , "MAC": , "RSSI": , "HostName": , "ConnectedSSID": }` 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