Skip to content

Commit

Permalink
add notes about payload_xxx, state_xxx and value_template (home-assis…
Browse files Browse the repository at this point in the history
…tant#12237)

* add notes about payload_xxx, state_xxx and value_template

There is a complex relationship between payload_xxx, state_xxx and value_template but it’s not reflected at all or well enough to understand how to use them.
That leads to a lot of confusion on how to configure it properly (like this- https://community.home-assistant.io/t/mqtt-switch-value-template/175463)
I think my notes will help.

* ✏️ Tweak

Co-authored-by: Klaas Schoute <[email protected]>
  • Loading branch information
akasma74 and klaasnicolaas authored Mar 2, 2020
1 parent e83d466 commit 025f5e6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions source/_integrations/switch.mqtt.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ payload_not_available:
type: string
default: offline
payload_off:
description: The payload that represents disabled state.
description: The payload that represents `off` state. If specified, will be used for both comparing to the value in the `state_topic` (see `value_template` and `state_off` for details) and sending as `off` command to the `command_topic`.
required: false
type: string
default: "OFF"
payload_on:
description: The payload that represents enabled state.
description: The payload that represents `on` state. If specified, will be used for both comparing to the value in the `state_topic` (see `value_template` and `state_on` for details) and sending as `on` command to the `command_topic`.
required: false
type: string
default: "ON"
Expand All @@ -118,12 +118,12 @@ retain:
type: boolean
default: false
state_off:
description: The payload that represents the off state.
description: The payload that represents the `off` state. Used when value that represents `off` state in the `state_topic` is different from value that should be sent to the `command_topic` to turn the device `off`.
required: false
type: string
default: "`payload_off` if defined, else OFF"
state_on:
description: The payload that represents the on state.
description: The payload that represents the `on` state. Used when value that represents `on` state in the `state_topic` is different from value that should be sent to the `command_topic` to turn the device `on`.
required: false
type: string
default: "`payload_on` if defined, else ON"
Expand All @@ -132,7 +132,7 @@ state_topic:
required: false
type: string
value_template:
description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract a value from the payload."
description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract device's state from the `state_topic`. To determine the switches's state result of this template will be compared to `state_on` and `state_off`."
required: false
type: string
{% endconfiguration %}
Expand Down

0 comments on commit 025f5e6

Please sign in to comment.