diff --git a/source/_docs/configuration/templating.markdown b/source/_docs/configuration/templating.markdown index 4f75749683a5..931a30d70083 100644 --- a/source/_docs/configuration/templating.markdown +++ b/source/_docs/configuration/templating.markdown @@ -1636,11 +1636,13 @@ Example value template: With given payload: ```json -{ "state": "ON", "temperature": 21.902 } +{ "state": "ON", "temperature": 21.902, "humidity": null } ``` Template {% raw %}`{{ value_json.temperature | round(1) }}`{% endraw %} renders to `21.9`. +Template {% raw %}`{{ value_json.humidity }}`{% endraw %} renders to `None`. + {% endnote %} #### Using command templates with MQTT diff --git a/source/_integrations/sensor.mqtt.markdown b/source/_integrations/sensor.mqtt.markdown index 1cf23ea7a427..e2d4639f77d9 100644 --- a/source/_integrations/sensor.mqtt.markdown +++ b/source/_integrations/sensor.mqtt.markdown @@ -201,7 +201,7 @@ state_class: required: false type: string state_topic: - description: The MQTT topic subscribed to receive sensor values. If `device_class`, `state_class`, `unit_of_measurement` or `suggested_display_precision` is set, and a numeric value is expected, an empty value `''` will be ignored and will not update the state, a `'null'` value will set the sensor to an `unknown` state. The `device_class` can be `null`. + description: The MQTT topic subscribed to receive sensor values. If `device_class`, `state_class`, `unit_of_measurement` or `suggested_display_precision` is set, and a numeric value is expected, an empty value `''` will be ignored and will not update the state, a `'None'` value will set the sensor to an `unknown` state. If a `value_template` is used to parse a JSON payload, a `null` value in the JSON [will be rendered as]((/docs/configuration/templating/#using-value-templates-with-mqtt)) `'None'`. Note that the `device_class` can be `null`. required: true type: string unique_id: