From b43a263a479a5cb3166da1387909bbbe55df07f8 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 10 Oct 2016 21:22:59 +0200 Subject: [PATCH] Fix templates --- source/_components/sensor.mqtt.markdown | 34 ++++++++++++------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/source/_components/sensor.mqtt.markdown b/source/_components/sensor.mqtt.markdown index 8c8ffe7d804..518d3444f09 100644 --- a/source/_components/sensor.mqtt.markdown +++ b/source/_components/sensor.mqtt.markdown @@ -50,11 +50,11 @@ Thus the trick is extract the battery level from the payload. ```yaml # Example configuration.yml entry sensor: - platform: mqtt - state_topic: "owntracks/tablet/tablet" - name: "Battery Tablet" - unit_of_measurement: "%" - value_template: {% raw %}'{{ value_json.batt }}'{% endraw %} + - platform: mqtt + state_topic: "owntracks/tablet/tablet" + name: "Battery Tablet" + unit_of_measurement: "%" + value_template: {% raw %}'{{ value_json.batt }}'{% endraw %} ``` ### {% linkable_title Get temperature and humidity %} @@ -73,17 +73,15 @@ Then use this configuration example to extract the data from the payload: ```yaml # Example configuration.yml entry -sensor 1: - platform: mqtt - state_topic: 'office/sensor1' - name: 'Temperature' - unit_of_measurement: '°C' - value_template: '{{ value_json.temperature }}' - -sensor 2: - platform: mqtt - state_topic: 'office/sensor1' - name: 'Humidity' - unit_of_measurement: '%' - value_template: '{{ value_json.humidity }}' +sensor: + - platform: mqtt + state_topic: 'office/sensor1' + name: 'Temperature' + unit_of_measurement: '°C' + value_template: {% raw %}'{{ value_json.temperature }}'{% endraw %} + - platform: mqtt + state_topic: 'office/sensor1' + name: 'Humidity' + unit_of_measurement: '%' + value_template: {% raw %}'{{ value_json.humidity }}'{% endraw %} ```