mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-15 21:36:52 +00:00
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
This commit is contained in:
parent
317b10bdaf
commit
bcaddb86cb
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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": <status>, "Time": <time>}, "Timer2":{"Arm": <status>, "Time": <time>}}` on topic `tele/sonoff/sensor` with a template to add `Timer1.Arm` and `Timer1.Time` as extra attributes. Extra attributes will be displayed in the frontend and can also be extracted in [Templates](/docs/configuration/templating/#attributes). For example, to extract the `Arm` attribute from the sensor below, use a template similar to: {% raw %}`{{ state_attr('sensor.timer1', 'Arm') }}`{% endraw %}.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
sensor:
|
||||
- platform: mqtt
|
||||
name: "Timer 1"
|
||||
state_topic: "tele/sonoff/sensor"
|
||||
value_template: "{{ value_json.Timer1.Arm }}"
|
||||
json_attributes_topic: "tele/sonoff/sensor"
|
||||
json_attributes_template: "{{ value_json.Timer1 | tojson }}"
|
||||
- platform: mqtt
|
||||
name: "Timer 2"
|
||||
state_topic: "tele/sonoff/sensor"
|
||||
value_template: "{{ value_json.Timer2.Arm }}"
|
||||
json_attributes_topic: "tele/sonoff/sensor"
|
||||
json_attributes_template: "{{ value_json.Timer2 | tojson }}"
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### {% linkable_title Get battery level %}
|
||||
|
||||
If you are using the [OwnTracks](/components/device_tracker.owntracks/) and enable the reporting of the battery level then you can use a MQTT sensor to keep track of your battery. A regular MQTT message from OwnTracks looks like this:
|
||||
|
@ -107,6 +107,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 switch 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
|
||||
|
@ -162,6 +162,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
|
||||
{% endconfiguration %}
|
||||
|
||||
### {% linkable_title Full configuration example %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user