Arduino only has FirmataStandard, as advised in the integration docs.
From my understanding this is doable via automations, right?
I might look at the core code, this is why I am asking if it makes sense to have push buttons in the core with a configurable delay of X seconds before reverting back to off state.
I think your best bet would to be bring your push button into home assistant as a binary_sensor. Then you can use that as a trigger for an automation to turn on an input_boolean for however long you require and then turn it off again.
I needed a UI button that I could use to trigger a ESP32-Cam through MQTT to take a photo. Below are the steps I followed to make a momentary switch/button, and below that the related automation in yaml to make it work.
In summary, I created a input_boolean Helper, made it visible on the dashboard as a Button, and used an Automation to change the state back to off after a short delay.
Create a input_boolean in Configuration -> Helpers. (To allow you to follow the example below, mine is called “Take Gate Photo”, and the entity_id then translates to “input_boolean.takegatephoto”).
In Lovelace, edit the dashboard (three vertical dots top right), add an appropriate card to your liking, and set the entity to the newly created input_boolean. (I added a button, with Tap Action set to Toggle (default) ).
Add something similar to the example below to your automations.yaml, customized based on your situation.
In Configuration -> Server Controls, check the configuration to make sure it is valid.
Do Reload Automations to implement the changes, and test to see if it works.
# Automatically reset button state back to "off" after short timeout
- alias: Take Gate Photo
trigger:
platform: state
entity_id: input_boolean.takegatephoto
to: "on"
condition: []
action:
- delay: 0:0.9
- service: input_boolean.turn_off
entity_id: input_boolean.takegatephoto
The way I’ve done a pushbutton is to use a cover with MQTT and a button card. Don’t specify any device class, specify the open and close payload the same. On the Lovelace button card specify the entity ID of the cover (e.g. cover.garage_door1_light), a name (Garage Light) and whatever icon you like (hass:lightbulb), set the action to toggle. In this example I don’t have a state sent back so I leave the Show State toggle off so it doesn’t always show “unknown”. My hardware is custom and responds to the MQTT topic (garage/door1/control) and command (toggle), but you can also use Node Red to subscribe to the topic to have it act on the press based on the topic included in a payload.
how to make to button card that always holds the button pushed for xy milisecond?
Reason is i want drive an alarm panel that needs 2 second long push signal. (no less than 2sec and no point for longer push)