The MQTT integration defines a Device Trigger sensor (MQTT Device Trigger - Home Assistant). This is really useful for buttons.
Is there any way to create a similar device trigger in ESPHome?
Right now, the documentation seems to suggest that a binary_sensor
is the “correct” way to do this, but it’s not always convenient, depending on the exact hardware. In my case, I’m working on a TOPGREENER TGWFSC8 Scene Controller, and the data received from the Tuya MCU component simply updates a datapoint for each button, but never changes the datapoint’s value. As such, the solution I’ve come up with is to use a template binary_sensor
, and then have on_datapoint_update
turn on this binary_sensor
, delay 0.2s, and then turn off the binary_sensor
.
Is there a better way to do this that actually creates a sensor in HA? I looked at using the homeassistant.event
action, but messing with event triggers is much less user-friendly than sensor triggers.