Minimizing of the configuration sample (#1008)

This commit is contained in:
Fabian Affolter 2016-09-30 20:48:56 +02:00 committed by GitHub
parent a09ede5b63
commit de7c1d5ac9
22 changed files with 143 additions and 127 deletions

View file

@ -10,6 +10,7 @@ footer: true
logo: mqtt.png
ha_category: Binary Sensor
ha_release: 0.9
ha_iot_class: "Depends"
---
@ -20,14 +21,8 @@ To use your MQTT binary sensor in your installation, add the following to your `
```yaml
# Example configuration.yml entry
binary_sensor:
platform: mqtt
state_topic: "home-assistant/window/contact"
name: "MQTT Sensor"
qos: 0
payload_on: "ON"
payload_off: "OFF"
sensor_class: opening
value_template: '{% raw %}{{ value.x }}{% endraw %}'
- platform: mqtt
state_topic: "home-assistant/window/contact"
```
Configuration variables:
@ -40,9 +35,24 @@ Configuration variables:
- **sensor_class** (*Optional*): The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend.
- **value_template** (*Optional*): Defines a [template](/topics/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:
For a quick check you can use the commandline tools shipped with `mosquitto` to send MQTT messages. Set the state of a sensor manually:
```bash
$ mosquitto_pub -h 127.0.0.1 -t home-assistant/window/contact -m "OFF"
```
An extended configuration for the same sensor could look like this if you want/need to be more specific.
```yaml
# Example configuration.yml entry
binary_sensor:
platform: mqtt
state_topic: "home-assistant/window/contact"
name: "Windows contact"
qos: 0
payload_on: "1"
payload_off: "0"
sensor_class: opening
value_template: '{% raw %}{{ value.x }}{% endraw %}'
```