MQTT Device Trigger


The mqtt device trigger platform uses an MQTT message payload to generate device trigger events.

An MQTT device trigger is a better option than a binary sensor for buttons, remote controls etc.

Configuration

MQTT device triggers are only supported through MQTT discovery, manual setup through configuration.yaml is not supported. The discovery topic needs to be: <discovery_prefix>/device_automation/[<node_id>/]<object_id>/config.

Configuration Variables

automation_typestringRequired

The type of automation, must be ‘trigger’.

payloadstring(Optional)

Optional payload to match the payload being sent over the topic.

qosinteger(Optional, default: 0)

The maximum QoS level to be used when receiving messages.

topicstringRequired

The MQTT topic subscribed to receive trigger events.

typestringRequired

The type of the trigger, e.g. button_short_press. Entries supported by the frontend: button_short_press, button_short_release, button_long_press, button_long_release, button_double_press, button_triple_press, button_quadruple_press, button_quintuple_press. If set to an unsupported value, will render as subtype type, e.g. First button spammed with type set to spammed and subtype set to button_1

subtypestringRequired

The subtype of the trigger, e.g. button_1. Entries supported by the frontend: turn_on, turn_off, button_1, button_2, button_3, button_4, button_5, button_6. If set to an unsupported value, will render as subtype type, e.g. left_button pressed with type set to button_short_press and subtype set to left_button

devicemapRequired

Information about the device this device trigger is a part of to tie it into the device registry.

connectionslist | map(Optional)

A list of connections of the device to the outside world as a list of tuples [connection_type, connection_identifier]. For example the MAC address of a network interface: 'connections': ['mac', '02:5b:26:a8:dc:12'].

identifierslist | string(Optional)

A list of IDs that uniquely identify the device. For example a serial number.

manufacturerstring(Optional)

The manufacturer of the device.

modelstring(Optional)

The model of the device.

namestring(Optional)

The name of the device.

sw_versionstring(Optional)

The firmware version of the device.

via_devicestring(Optional)

Identifier of a device that routes messages between this device and Home Assistant. Examples of such devices are hubs, or parent devices of a sub-device. This is used to show device topology in Home Assistant.