MQTT button config to integration key (#22816)

This commit is contained in:
Jan Bouwhuis 2022-05-23 14:21:53 +02:00 committed by GitHub
parent 029d32f982
commit 6f72a91d0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,11 +14,30 @@ The `mqtt` button platform lets you send an MQTT message when the button is pres
```yaml
# Example configuration.yaml entry
mqtt:
button:
- command_topic: "home/bedroom/switch1/reboot"
```
<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 `button` 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
button:
- platform: mqtt
command_topic: "home/bedroom/switch1/reboot"
```
{% enddetails %}
{% configuration %}
availability:
description: A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with `availability_topic`.
@ -193,16 +212,16 @@ The example below shows a full configuration for a button.
```yaml
# Example configuration.yaml entry
button:
- platform: mqtt
unique_id: bedroom_switch_reboot_btn
name: "Restart Bedroom Switch"
command_topic: "home/bedroom/switch1/commands"
payload_press: "restart"
availability:
- topic: "home/bedroom/switch1/available"
qos: 0
retain: false
entity_category: "config"
device_class: "restart"
mqtt:
button:
- unique_id: bedroom_switch_reboot_btn
name: "Restart Bedroom Switch"
command_topic: "home/bedroom/switch1/commands"
payload_press: "restart"
availability:
- topic: "home/bedroom/switch1/available"
qos: 0
retain: false
entity_category: "config"
device_class: "restart"
```