diff --git a/source/_integrations/device_trigger.mqtt.markdown b/source/_integrations/device_trigger.mqtt.markdown index a51193e03e7..20b638be245 100644 --- a/source/_integrations/device_trigger.mqtt.markdown +++ b/source/_integrations/device_trigger.mqtt.markdown @@ -15,7 +15,7 @@ An MQTT device trigger is a better option than a [binary sensor](/integrations/b ## Configuration MQTT device triggers are only supported through [MQTT discovery](/docs/mqtt/discovery/), manual setup through `configuration.yaml` is not supported. -The discovery topic needs to be: `/device_automation/[/]/config`. +The discovery topic needs to be: `/device_automation/[/]/config`. Note that only one trigger may be defined per unique discovery topic. Also note that the combination of `type` and `subtype` should be unique for a device. {% configuration %} automation_type: @@ -81,3 +81,26 @@ device: required: false type: string {% endconfiguration %} + +### Example + +This shows a complete example of defining a remote control type device with two triggers: "left arrow click" and "right arrow click". + +Note that it is not necessary to provide the full device information in each message, but the identifying information, `identifier` in the example, must be the same. + +#### Left arrow click configuration: +- Discovery topic: `homeassistant/device_automation/0x90fd9ffffedf1266/action_arrow_left_click/config` +- Discovery payload: + ```json + {"automation_type":"trigger","type":"action","subtype":"arrow_left_click","payload":"arrow_left_click","topic":"zigbee2mqtt/0x90fd9ffffedf1266/action","device":{"identifiers":["zigbee2mqtt_0x90fd9ffffedf1266"],"name":"0x90fd9ffffedf1266","sw_version":"Zigbee2mqtt 1.14.0","model":"TRADFRI remote control (E1524/E1810)","manufacturer":"IKEA"}} + ``` +- Trigger topic: `zigbee2mqtt/0x90fd9ffffedf1266/action` +- Trigger payload: `arrow_left_click` +#### Right arrow click configuration: +- Discovery topic: `homeassistant/device_automation/0x90fd9ffffedf1266/action_arrow_right_click/config` +- Discovery payload: + ```json + {"automation_type":"trigger","type":"action","subtype":"arrow_right_click","payload":"arrow_right_click","topic":"zigbee2mqtt/0x90fd9ffffedf1266/action","device":{"identifiers":["zigbee2mqtt_0x90fd9ffffedf1266"]}} + ``` +- Trigger topic: `zigbee2mqtt/0x90fd9ffffedf1266/action` +- Trigger payload: `arrow_right_click`