From bcaddb86cb60b86d831c6a75c7d8810680f46595 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Sun, 28 Apr 2019 18:43:59 +0200 Subject: [PATCH] Update MQTT documentation with json_attributes_topic (#9332) * Update sensor.mqtt.markdown * Update alarm_control_panel.mqtt.markdown * Update binary_sensor.mqtt.markdown * Update climate.mqtt.markdown * Update cover.mqtt.markdown * Update fan.mqtt.markdown * Update light.mqtt.markdown * Update lock.mqtt.markdown * Update switch.mqtt.markdown * Update vacuum.mqtt.markdown * Update binary_sensor.mqtt.markdown * Update climate.mqtt.markdown * Update cover.mqtt.markdown * Update fan.mqtt.markdown * Update light.mqtt.markdown * Update sensor.mqtt.markdown * Update sensor.mqtt.markdown * Update alarm_control_panel.mqtt.markdown * Update binary_sensor.mqtt.markdown * Update climate.mqtt.markdown * Update cover.mqtt.markdown * Update fan.mqtt.markdown * Update light.mqtt.markdown * Update lock.mqtt.markdown * Update switch.mqtt.markdown * Update vacuum.mqtt.markdown --- .../alarm_control_panel.mqtt.markdown | 4 +++ .../_components/binary_sensor.mqtt.markdown | 4 +++ source/_components/climate.mqtt.markdown | 4 +++ source/_components/cover.mqtt.markdown | 4 +++ source/_components/fan.mqtt.markdown | 4 +++ source/_components/light.mqtt.markdown | 11 ++++++++ source/_components/lock.mqtt.markdown | 4 +++ source/_components/sensor.mqtt.markdown | 26 +++++++++++++++++++ source/_components/switch.mqtt.markdown | 4 +++ source/_components/vacuum.mqtt.markdown | 4 +++ 10 files changed, 69 insertions(+) diff --git a/source/_components/alarm_control_panel.mqtt.markdown b/source/_components/alarm_control_panel.mqtt.markdown index c7aebf5b465..315752dc1f8 100644 --- a/source/_components/alarm_control_panel.mqtt.markdown +++ b/source/_components/alarm_control_panel.mqtt.markdown @@ -122,6 +122,10 @@ json_attributes_topic: description: The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-topic-configuration) documentation. required: false type: string +json_attributes_template: + description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the JSON dictionary from messages received on the `json_attributes_topic`. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-template-configuration) documentation." + required: false + type: template device: description: 'Information about the device this alarm panel is a part of to tie it into the [device registry](https://developers.home-assistant.io/docs/en/device_registry_index.html). Only works through [MQTT discovery](/docs/mqtt/discovery/) and when [`unique_id`](#unique_id) is set.' required: false diff --git a/source/_components/binary_sensor.mqtt.markdown b/source/_components/binary_sensor.mqtt.markdown index b766216f130..6be6f03c507 100644 --- a/source/_components/binary_sensor.mqtt.markdown +++ b/source/_components/binary_sensor.mqtt.markdown @@ -72,6 +72,10 @@ json_attributes_topic: description: The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-topic-configuration) documentation. required: false type: string +json_attributes_template: + description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the JSON dictionary from messages received on the `json_attributes_topic`. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-template-configuration) documentation." + required: false + type: template qos: description: The maximum QoS level to be used when receiving messages. required: false diff --git a/source/_components/climate.mqtt.markdown b/source/_components/climate.mqtt.markdown index 6a33821148b..4d62105e01b 100644 --- a/source/_components/climate.mqtt.markdown +++ b/source/_components/climate.mqtt.markdown @@ -231,6 +231,10 @@ json_attributes_topic: description: The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-topic-configuration) documentation. required: false type: string +json_attributes_template: + description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the JSON dictionary from messages received on the `json_attributes_topic`. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-template-configuration) documentation." + required: false + type: template device: description: 'Information about the device this HVAC device is a part of to tie it into the [device registry](https://developers.home-assistant.io/docs/en/device_registry_index.html). Only works through [MQTT discovery](/docs/mqtt/discovery/) and when [`unique_id`](#unique_id) is set.' required: false diff --git a/source/_components/cover.mqtt.markdown b/source/_components/cover.mqtt.markdown index 05600527804..205e50be6ce 100644 --- a/source/_components/cover.mqtt.markdown +++ b/source/_components/cover.mqtt.markdown @@ -181,6 +181,10 @@ json_attributes_topic: description: The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-topic-configuration) documentation. required: false type: string +json_attributes_template: + description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the JSON dictionary from messages received on the `json_attributes_topic`. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-template-configuration) documentation." + required: false + type: template unique_id: description: An ID that uniquely identifies this cover. If two covers have the same unique ID, Home Assistant will raise an exception. required: false diff --git a/source/_components/fan.mqtt.markdown b/source/_components/fan.mqtt.markdown index 28c6649e9d9..72c2ad4077a 100644 --- a/source/_components/fan.mqtt.markdown +++ b/source/_components/fan.mqtt.markdown @@ -146,6 +146,10 @@ json_attributes_topic: description: The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-topic-configuration) documentation. required: false type: string +json_attributes_template: + description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the JSON dictionary from messages received on the `json_attributes_topic`. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-template-configuration) documentation." + required: false + type: template unique_id: description: An ID that uniquely identifies this fan. If two fans have the same unique ID, Home Assistant will raise an exception. required: false diff --git a/source/_components/light.mqtt.markdown b/source/_components/light.mqtt.markdown index 8975bd52682..696b36a208a 100644 --- a/source/_components/light.mqtt.markdown +++ b/source/_components/light.mqtt.markdown @@ -230,6 +230,10 @@ json_attributes_topic: description: The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-topic-configuration) documentation. required: false type: string +json_attributes_template: + description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the JSON dictionary from messages received on the `json_attributes_topic`. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-template-configuration) documentation." + required: false + type: template device: description: 'Information about the device this light is a part of to tie it into the [device registry](https://developers.home-assistant.io/docs/en/device_registry_index.html). Only works through [MQTT discovery](/docs/mqtt/discovery/) and when [`unique_id`](#unique_id) is set.' required: false @@ -488,6 +492,10 @@ json_attributes_topic: description: The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-topic-configuration) documentation. required: false type: string +json_attributes_template: + description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the JSON dictionary from messages received on the `json_attributes_topic`. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-template-configuration) documentation." + required: false + type: template device: description: 'Information about the device this light is a part of to tie it into the [device registry](https://developers.home-assistant.io/docs/en/device_registry_index.html). Only works through [MQTT discovery](/docs/mqtt/discovery/) and when [`unique_id`](#unique_id) is set.' required: false @@ -759,6 +767,9 @@ json_attributes_topic: description: The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-topic-configuration) documentation. required: false type: string +json_attributes_template: + description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the JSON dictionary from messages received on the `json_attributes_topic`. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-template-configuration) documentation." + required: false device: description: 'Information about the device this light is a part of to tie it into the [device registry](https://developers.home-assistant.io/docs/en/device_registry_index.html). Only works through [MQTT discovery](/docs/mqtt/discovery/) and when [`unique_id`](#unique_id) is set.' required: false diff --git a/source/_components/lock.mqtt.markdown b/source/_components/lock.mqtt.markdown index a457b54578a..6c340b79c2b 100644 --- a/source/_components/lock.mqtt.markdown +++ b/source/_components/lock.mqtt.markdown @@ -93,6 +93,10 @@ json_attributes_topic: description: The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-topic-configuration) documentation. required: false type: string +json_attributes_template: + description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the JSON dictionary from messages received on the `json_attributes_topic`. Usage example can be found in [MQTT sensor](/components/sensor.mqtt/#json-attributes-template-configuration) documentation." + required: false + type: template unique_id: description: An ID that uniquely identifies this lock. If two locks have the same unique ID, Home Assistant will raise an exception. required: false diff --git a/source/_components/sensor.mqtt.markdown b/source/_components/sensor.mqtt.markdown index fe808d76995..278e206c2e5 100644 --- a/source/_components/sensor.mqtt.markdown +++ b/source/_components/sensor.mqtt.markdown @@ -81,6 +81,9 @@ 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_template: + description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the JSON dictionary from messages received on the `json_attributes_topic`." + required: false json_attributes: 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 @@ -149,6 +152,29 @@ sensor: ``` {% endraw %} +### {% linkable_title JSON attributes template configuration %} + +The example sensor below shows a configuration example which uses a JSON dict: `{"Timer1":{"Arm": , "Time":