From d13cd890b8d859e8e8154ed63efad2a33cd0b237 Mon Sep 17 00:00:00 2001 From: emontnemery Date: Mon, 24 Sep 2018 10:22:33 +0200 Subject: [PATCH] Documentation for removal of discovered device (#6276) * Update discovery.markdown * Minor change --- source/_docs/mqtt/discovery.markdown | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/_docs/mqtt/discovery.markdown b/source/_docs/mqtt/discovery.markdown index 75a56503e8a..a7477b959da 100644 --- a/source/_docs/mqtt/discovery.markdown +++ b/source/_docs/mqtt/discovery.markdown @@ -22,7 +22,6 @@ Supported by MQTT discovery: - [Sensors](/components/sensor.mqtt/) - [Switches](/components/switch.mqtt/) - To enable MQTT discovery, add the following to your `configuration.yaml` file: ```yaml @@ -49,6 +48,8 @@ The discovery topic need to follow a specific format: The payload will be checked like an entry in your `configuration.yaml` file if a new device is added. This means that missing variables will be filled with the platform's default values. All configuration variables which are *required* must be present in the initial payload send to `/config`. +An empty payload will cause a previously discovered device to be deleted. + The `` level can be used by clients to only subscribe to their own (command) topics by using one wildcard topic like `/+//+/set`. ### {% linkable_title Support by third-party tools %} @@ -79,6 +80,12 @@ Update the state. $ mosquitto_pub -h 127.0.0.1 -p 1883 -t "homeassistant/binary_sensor/garden/state" -m ON ``` +Delete the sensor by sending an empty message. + + ```bash +$ mosquitto_pub -h 127.0.0.1 -p 1883 -t "homeassistant/binary_sensor/garden/state" -m '' +``` + Setting up a switch is similar but requires a `command_topic` as mentioned in the [MQTT switch documentation](/components/switch.mqtt/). - Configuration topic: `homeassistant/switch/irrigation/config`