From 3f6f8c4048c02ca777b7f216b327cd6de7a073f7 Mon Sep 17 00:00:00 2001 From: Martin Eberhardt Date: Thu, 29 Mar 2018 09:29:18 +0200 Subject: [PATCH] Fix ON/OFF being interpreted in binary_sensor.mqtt (#5042) * Fix ON/OFF being interpreted in binary_sensor.mqtt YAML interprets `ON` and `OFF` to `true` and `false`. This causes the site to show that instead of the actual default payloads. * Add header --- source/_components/binary_sensor.mqtt.markdown | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/_components/binary_sensor.mqtt.markdown b/source/_components/binary_sensor.mqtt.markdown index b49b21b3651..1c6a6d87eff 100644 --- a/source/_components/binary_sensor.mqtt.markdown +++ b/source/_components/binary_sensor.mqtt.markdown @@ -17,6 +17,8 @@ The `mqtt` binary sensor platform uses an MQTT message payload to set the binary The binary sensor state will be updated only after a new message is published on `state_topic` matching `payload_on` or `payload_off`. If these messages are published with the `retain` flag set, the binary sensor will receive an instant state update after subscription and Home Assistant will display the correct state on startup. Otherwise, the initial state displayed in Home Assistant will be `unknown`. +## {% linkable_title Configuration %} + The `mqtt` binary sensor platform optionally supports an `availability_topic` to receive online and offline messages (birth and LWT messages) from the MQTT device. During normal operation, if the MQTT cover device goes offline (i.e., publishes `payload_not_available` to `availability_topic`), Home Assistant will display the binary sensor as `unavailable`. If these messages are published with the `retain` flag set, the binary sensor will receive an instant update after subscription and Home Assistant will display the correct availability state of the binary sensor when Home Assistant starts up. If the `retain` flag is not set, Home Assistant will display the binary sensor as `unavailable` when Home Assistant starts up. If no `availability_topic` is defined, Home Assistant will consider the MQTT device to be available. To use an MQTT binary sensor in your installation, add the following to your `configuration.yaml` file: @@ -42,12 +44,12 @@ payload_on: description: The payload that represents the on state. required: false type: string - default: ON + default: "ON" payload_off: description: The payload that represents the off state. required: false type: string - default: OFF + default: "OFF" availability_topic: description: "The MQTT topic subscribed to receive birth and LWT messages from the MQTT device. If `availability_topic` is not defined, the binary sensor availability state will always be `available`. If `availability_topic` is defined, the binary sensor availability state will be `unavailable` by default." required: false