Fix #126 (Use real templates)

This commit is contained in:
Fabian Affolter 2015-12-18 13:05:57 +01:00
parent a8f0d48b82
commit 9c6e176e4c
11 changed files with 18 additions and 17 deletions

View File

@ -109,6 +109,8 @@ automation:
trigger:
platform: numeric_state
entity_id: sensor.temperature
# Optional
value_template: '{% raw %}{{ state.attributes.battery }}{% endraw %}'
# At least one of the following required
above: 17
below: 25

View File

@ -12,7 +12,7 @@ ha_category: Binary Sensor
---
This MQTT binary sensor implementation uses the MQTT message payload as the sensor value. If messages in this state_topic are published with *RETAIN* flag, the sensor will receive an instant update with the last known value. Otherwise, the initial state will be off.
This `mqtt` binary sensor implementation uses the MQTT message payload as the sensor value. If messages in this state_topic are published with *RETAIN* flag, the sensor will receive an instant update with the last known value. Otherwise, the initial state will be off.
To use your MQTT binary sensor in your installation, add the following to your `configuration.yaml` file:
@ -25,7 +25,7 @@ binary_sensor:
qos: 0
payload_on: "ON"
payload_of: "OFF"
value_template: '{% raw %}{{ template }}{% endraw %}'
value_template: '{% raw %}{{ value.x }}{% endraw %}'
```
Configuration variables:

View File

@ -12,7 +12,7 @@ ha_category: Presence Detection
---
This platform allows you to detect presence by monitoring an MQTT topic for new locations. To use this platform, you specify a unique topic for each device.
The `mqtt` device tracker platform allows you to detect presence by monitoring an MQTT topic for new locations. To use this platform, you specify a unique topic for each device.
To use this device tracker in your installation, add the following to your `configuration.yaml` file:

View File

@ -12,7 +12,7 @@ ha_category: Light
---
The mqtt light platform let you control your MQTT enabled light.
The `mqtt` light platform let you control your MQTT enabled light.
In an ideal scenario, the MQTT device will have a state topic to publish state changes. If these messages are published with RETAIN flag, the MQTT switch will receive an instant state update after subscription and will start with correct state. Otherwise, the initial state of the switch will be false/off.

View File

@ -27,6 +27,7 @@ motor:
payload_open: "OPEN"
payload_close: "CLOSE"
payload_stop: "STOP"
value_template: '{% raw %}{{ value.x }}{% endraw %}'
```
Configuration variables:
@ -39,4 +40,4 @@ Configuration variables:
- **payload_open** (*Optional*): The payload to open the rollershutter. Default is "OPEN".
- **payload_close** (*Optional*): The payload to close the rollershutter. Default is "CLOSE".
- **payload_stop** (*Optional*): The payload to stop the rollershutter. Default is "STOP".
- **state_format** (*Optional*): The state format to parse. Default is None (no parser).
- **value_template** (*Optional*): Defines a [template](/getting-started/templating/) to extract a value from the payload.

View File

@ -31,8 +31,7 @@ sensor:
A0:
name: Pin 0 analog
unit_of_measurement: "ca"
correction_factor: 0.01
decimal_places: 1
value_template: '{% raw %}{{ value_json.light }}{% endraw %}'
3:
name: Pin 3 digital
```
@ -47,8 +46,7 @@ Configuration variables:
- **pins** array (*Optional*): List of pins to monitor. Analog pins need a leading **A** for the pin number.
- **name** (*Optional*): The name of the variable you wish to monitor.
- **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.
The variables in the `monitored_variables` array must be available in the response of the device. As a starting point you could use the one of the example sketches (eg. [Ethernet](https://raw.githubusercontent.com/marcoschwartz/aREST/master/examples/Ethernet/Ethernet.ino) for an Arduino with Ethernet shield). In those sketches are two variables (`temperature` and `humidity`) available which will act as endpoints.
@ -78,4 +76,3 @@ The root will give you a JSON response that contains all variables and their cur
{"return_value": 34, "id": "sensor02", "name": "livingroom", "connected": true}
```

View File

@ -22,7 +22,7 @@ sensor:
command: SENSOR_COMMAND
name: Command sensor
unit_of_measurement: "°C"
value_template: '{% raw %}{{ template }}{% endraw %}'
value_template: '{% raw %}{{ value.x }}{% endraw %}'
```
Configuration variables:

View File

@ -24,7 +24,7 @@ sensor:
name: "MQTT Sensor"
qos: 0
unit_of_measurement: "°C"
value_template: '{% raw %}{{ template }}{% endraw %}'
value_template: '{% raw %}{{ value.x }}{% endraw %}'
```
Configuration variables:

View File

@ -11,7 +11,7 @@ ha_category: Sensor
---
The rest sensor platform is consuming a given endpoint which is exposed by a [RESTful API](https://en.wikipedia.org/wiki/Representational_state_transfer) of a device, an application, or a web service. The sensor has support for GET and POST requests.
The `rest` sensor platform is consuming a given endpoint which is exposed by a [RESTful API](https://en.wikipedia.org/wiki/Representational_state_transfer) of a device, an application, or a web service. The sensor has support for GET and POST requests.
To enable this sensor, add the following lines to your `configuration.yaml` file for a GET request:
@ -22,7 +22,7 @@ sensor:
resource: http://IP_ADDRESS/ENDPOINT
method: GET
name: REST GET sensor
value_template: '{% raw %}{{ template }}{% endraw %}'
value_template: '{% raw %}{{ value_json.x }}{% endraw %}'
unit_of_measurement: "°C"
```

View File

@ -11,6 +11,7 @@ logo: mqtt.png
ha_category: Switch
---
The `mqtt` switch platform let you control your MQTT enabled light.
In an ideal scenario, the MQTT device will have a state topic to publish state changes. If these messages are published with RETAIN flag, the MQTT switch will receive an instant state update after subscription and will start with correct state. Otherwise, the initial state of the switch will be false/off.
@ -31,7 +32,7 @@ switch:
payload_on: "ON"
payload_off: "OFF"
optimistic: false
state_format:
value_template: '{% raw %}{{ value.x }}{% endraw %}'
```
Configuration variables:
@ -43,7 +44,7 @@ Configuration variables:
- **payload_on** (*Optional*): The payload that represents enabled state. Default is "ON".
- **payload_off** (*Optional*): The payload that represents disabled state. Default is "OFF".
- **optimistic** (*Optional*): Flag that defines if switch works in optimistic mode. Default is true if no state topic defined, else false.
- **state_format** (*Optional*): Value to parse.
- **value_template** (*Optional*): Defines a [template](/getting-started/templating/) to extract a value from the payload.
<p class='note warning'>
Make sure that your topics match exact. `some-topic/` and `some-topic` are different topics.

View File

@ -11,7 +11,7 @@ ha_category: Switch
---
The rest switch platform allows you to control a given endpoint that supports a [RESTful API](https://en.wikipedia.org/wiki/Representational_state_transfer). The switch can get the state via GET and set the state via POST on a given REST resource.
The `rest` switch platform allows you to control a given endpoint that supports a [RESTful API](https://en.wikipedia.org/wiki/Representational_state_transfer). The switch can get the state via GET and set the state via POST on a given REST resource.
To enable this switch, add the following lines to your `configuration.yaml` file: