From 8088152e505722f8f26a52b8eb730ada74057acf Mon Sep 17 00:00:00 2001 From: Christian Gahlert <1876381+chrisgahlert@users.noreply.github.com> Date: Tue, 19 Mar 2024 09:10:10 +0100 Subject: [PATCH] Improve explanation of state_value_template and add example (#31928) * Improve explanation of state_value_template and add example * Fix syntax problems in documentation * tweaks, in an attempt to fix the build * Update source/_integrations/light.mqtt.markdown * Update source/_integrations/light.mqtt.markdown --------- Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com> --- source/_integrations/light.mqtt.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/light.mqtt.markdown b/source/_integrations/light.mqtt.markdown index c52818bb0b1..9bc7cbbde59 100644 --- a/source/_integrations/light.mqtt.markdown +++ b/source/_integrations/light.mqtt.markdown @@ -363,7 +363,7 @@ state_topic: required: false type: string state_value_template: - description: "Defines a [template](/docs/configuration/templating/#using-templates-with-the-mqtt-integration) to extract the state value. The template should match the payload `on` and `off` values, so if your light uses `power on` to turn on, your `state_value_template` string should return `power on` when the switch is on. For example if the message is just `on`, your `state_value_template` should be `power {{ value }}`." + description: "Defines a [template](/docs/configuration/templating/#using-templates-with-the-mqtt-integration) to extract the state value. The template should return the `payload_on` and `payload_off` values, so if your light uses `power on` to turn on, your `state_value_template` string should return `power on` when the switch is on. For example, if the message is just `on`, your `state_value_template` should be `power {{ value }}`. When your `payload_on = 27`, `payload_off = 'off'`, then this template might be `'off' if value_json.my_custom_brightness_field <= 0 else 27`." required: false type: template unique_id: