mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 09:17:06 +00:00
MQTT button config to integration key (#22816)
This commit is contained in:
parent
029d32f982
commit
6f72a91d0b
@ -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"
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user