diff --git a/source/_components/binary_sensor.mqtt.markdown b/source/_components/binary_sensor.mqtt.markdown index 50a97096714..9961e4c618f 100644 --- a/source/_components/binary_sensor.mqtt.markdown +++ b/source/_components/binary_sensor.mqtt.markdown @@ -25,6 +25,7 @@ binary_sensor: qos: 0 payload_on: "ON" payload_of: "OFF" + value_template: '{% raw %}{{ template }}{% endraw %}' ``` Configuration variables: @@ -34,7 +35,7 @@ Configuration variables: - **qos** (*Optional*): The maximum QoS level of the state topic. Default is 0. - **payload_on** (*Optional*): The payload that represents on state. Default is "ON". - **payload_off** (*Optional*): The payload that represents state. Default is "OFF". - +- **value_template** (*Optional*): Defines a [template](/getting-started/templating/) to extract a value from the payload. For a quick check you can use the commandline tools shipped with `mosquitto` to send MQTT messages. Set the state of your sensor manually: diff --git a/source/_components/sensor.command_sensor.markdown b/source/_components/sensor.command_sensor.markdown index b4a33408d8a..a70fac9e88b 100644 --- a/source/_components/sensor.command_sensor.markdown +++ b/source/_components/sensor.command_sensor.markdown @@ -22,8 +22,7 @@ sensor: command: SENSOR_COMMAND name: Command sensor unit_of_measurement: "°C" - correction_factor: 0.4921 - decimal_places: 0 + value_template: '{% raw %}{{ template }}{% endraw %}' ``` Configuration variables: @@ -31,8 +30,7 @@ Configuration variables: - **command** (*Required*): The action to take to get the value. - **name** (*Optional*): Name of the command sensor. - **unit_of_measurement** (*Optional*): Defines the unit of measurement of the sensor, if any. -- **correction_factor** (*Optional*): A float value to do some basic calculations. -- **decimal_places** (*Optional*): Number of decimal places of the value. +- **value_template** (*Optional*): Defines a [template](/getting-started/templating/) to extract a value from the payload. ## {% linkable_title Examples %} diff --git a/source/_components/sensor.mqtt.markdown b/source/_components/sensor.mqtt.markdown index ae2cbc120ed..ab022bdb293 100644 --- a/source/_components/sensor.mqtt.markdown +++ b/source/_components/sensor.mqtt.markdown @@ -24,7 +24,7 @@ sensor: name: "MQTT Sensor" qos: 0 unit_of_measurement: "°C" - value_template: '{{ value_json.value }}' + value_template: '{% raw %}{{ template }}{% endraw %}' ``` Configuration variables: @@ -33,7 +33,7 @@ Configuration variables: - **name** (*Optional*): The name of the sensor. Default is 'MQTT Sensor'. - **qos** (*Optional*): The maximum QoS level of the state topic. Default is 0. - **unit_of_measurement** (*Optional*): Defines the units of measurement of the sensor, if any. -- **value_template** (*Optional*): Defines a template to extract a value from the payload. +- **value_template** (*Optional*): Defines a [template](/getting-started/templating/) to extract a value from the payload. ## {% linkable_title Examples %} diff --git a/source/_components/sensor.rest.markdown b/source/_components/sensor.rest.markdown index 546a0624b4c..b8f1a32b304 100644 --- a/source/_components/sensor.rest.markdown +++ b/source/_components/sensor.rest.markdown @@ -36,24 +36,20 @@ sensor: platform: rest resource: http://IP_ADDRESS/ENDPOINT method: POST - variable: 'temperature' or ['Temperatures', 0, 'CurrentReading'] + value_template: '{% raw %}{{ template }}{% endraw %}' payload: '{ "device" : "heater" }' name: REST POST sensor unit_of_measurement: "°C" - correction_factor: 0.0001 - decimal_places: 0 ``` Configuration variables: - **resource** (*Required*): The resource or endpoint that contains the value. - **method** (*Optional*): The method of the request. Default is GET. -- **variable** (*Optional*): Defines the variable or a list of element for complex responses to extract, if any. +- **value_template** (*Optional*): Defines a [template](/getting-started/templating/) to extract a value from the payload. - **payload** (*Optional*): The payload to send with a POST request. Usualy formed as a dictionary- - **name** (*Optional*): Name of the REST sensor. - **unit_of_measurement** (*Optional*): Defines the unit of measurement of the sensor, if any. -- **correction_factor** (*Optional*): A float value to do some basic calculations. -- **decimal_places** (*Optional*): Number of decimal places of the value.
Make sure that the URL matches exactly your endpoint or resource.