dawidchyrzynski / arduino-home-assistant

ArduinoHA allows to integrate an Arduino/ESP based device with Home Assistant using MQTT.
https://dawidchyrzynski.github.io/arduino-home-assistant/
GNU Affero General Public License v3.0
498 stars 118 forks source link

HAButton that trigger service on HomeAssistant #167

Closed mariusmotea closed 8 months ago

mariusmotea commented 1 year ago

Hi,

I have an Elecrow ESP32-S3 display with touch control and i want to have it like a room dashboard. I also want to have some buttons on the display that will control devices connected to HomeAssistant (ex: garage door, vacuum robot) using some logic at home assistant level. Currently to achieve this i need to create a switch that is toggled on/off with a delay in-between, but according to home assistant this may also be possible with MQTT button integration?

The mqtt button platform lets you send an MQTT message when the button is pressed in the frontend or the button press service is called

erkr commented 10 months ago

I think the HADeviceTrigger is what you need for that

dawidchyrzynski commented 8 months ago

https://github.com/dawidchyrzynski/arduino-home-assistant/blob/main/examples/multi-state-button/multi-state-button.ino

mariusmotea commented 8 months ago

Unfortunately i tried entire day the multi state button example and nothing is happening in Home Assistant. I see the actions in the MQTT broker with MQTT Explorer, but HomeAssistant ignore the events. HAButton and HASwitch are working fine if i set such devices. How i can link the long press and short press to the same entity? I have some wall switches with 3 buttons and i want to get in HomeAssistant one button entity with the type button_short_press and button_long_press and the subtype button_1, button_2 and button_3.

Thanks.