mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 17:27:19 +00:00
MQTT binary_sensor config to integration key (#22817)
This commit is contained in:
parent
b025c759ea
commit
029d32f982
@ -25,11 +25,30 @@ add the following to your `configuration.yaml` file:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
|
mqtt:
|
||||||
|
binary_sensor:
|
||||||
|
- state_topic: "home-assistant/window/contact"
|
||||||
|
```
|
||||||
|
|
||||||
|
<a id='new_format'></a>
|
||||||
|
|
||||||
|
{% details "Previous configuration format" %}
|
||||||
|
|
||||||
|
The configuration format of manual configured MQTT items has changed.
|
||||||
|
The old format that places configurations under the `binary_sensor` platform key
|
||||||
|
should no longer be used and is deprecated.
|
||||||
|
|
||||||
|
The above example shows the new and modern way,
|
||||||
|
this is the previous/old example:
|
||||||
|
|
||||||
|
```yaml
|
||||||
binary_sensor:
|
binary_sensor:
|
||||||
- platform: mqtt
|
- platform: mqtt
|
||||||
state_topic: "home-assistant/window/contact"
|
state_topic: "home-assistant/window/contact"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
{% enddetails %}
|
||||||
|
|
||||||
{% configuration %}
|
{% configuration %}
|
||||||
availability:
|
availability:
|
||||||
description: A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with `availability_topic`.
|
description: A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with `availability_topic`.
|
||||||
@ -223,9 +242,9 @@ The example below shows a full configuration for a binary sensor:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
binary_sensor:
|
mqtt:
|
||||||
- platform: mqtt
|
binary_sensor:
|
||||||
name: "Window Contact Sensor"
|
- name: "Window Contact Sensor"
|
||||||
state_topic: "home-assistant/window/contact"
|
state_topic: "home-assistant/window/contact"
|
||||||
payload_on: "ON"
|
payload_on: "ON"
|
||||||
availability:
|
availability:
|
||||||
@ -245,9 +264,9 @@ binary_sensor:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
binary_sensor:
|
mqtt:
|
||||||
- platform: mqtt
|
binary_sensor:
|
||||||
state_topic: "lab_button/cmnd/POWER"
|
- state_topic: "lab_button/cmnd/POWER"
|
||||||
value_template: "{%if is_state(entity_id,\"on\")-%}OFF{%-else-%}ON{%-endif%}"
|
value_template: "{%if is_state(entity_id,\"on\")-%}OFF{%-else-%}ON{%-endif%}"
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -269,9 +288,9 @@ The configuration will look like the example below:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
binary_sensor:
|
mqtt:
|
||||||
- platform: mqtt
|
binary_sensor:
|
||||||
name: Bathroom
|
- name: Bathroom
|
||||||
state_topic: "home/bathroom/switch/button"
|
state_topic: "home/bathroom/switch/button"
|
||||||
payload_on: "1"
|
payload_on: "1"
|
||||||
payload_off: "0"
|
payload_off: "0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user