Button, works like a key-switch

For security reasons I need a button, that works like a button.
That means as long pressed a switch is on, and once released it is off.
The button should regulate a pool safety cover, driven by a strong hydraulic motor.
It is necessary to see the cover and the cover should only move, as long the button is pressed.
And additionally it must be prohibited that the button for “Open” and “Close” could be pressed at the same time.

Any suggestions???

That sounds like you need a momentary button connected to a relay. You don’t need home assistant for any of that.

Well, I have something like a relay. My home has a KNX-System.
What I want is to switch the relay (in knx called actor) by a home assistent button on my frontend.

Is this possible?

Button entities in HA fire an event and change state when they are pressed, but nothing happens when the button is released. There is however a custom button card for the frontend that can do actions while the button is held.

But I don’t understand how you want the hardware to function. Any sort of command originating from HA will be discrete (not continuous). And there is no such thing as a momentary WiFi/Zigbee/Z-Wave/etc switch. But there are switches that can be programmed to automatically turn off after a programmable delay. So I can think of several options:

  1. You have a relay with a programmable turn-off delay. You set the turn-off delay for 1 second (for example). You then set up your custom button card to send “turn on” commands to the switch every 500ms (for example) while the button is pressed. No commands are issued when the button is released, and the relay will then turn odd after the programmed delay (1 second in this example). You’d have to verify your specific relay doesn’t turn off and on quickly if multiple turn-on commands are received while the relay is already turned on.
  2. You have a normal on/off relay. You set up the custom button card to send a “turn on” command when the button is pushed, then it will do nothing while the button is held, and then a “turn off” command is sent when the button is released. This method is much less safe because it could fail in the activated state (e.g. the “turn off” command isn’t received, or your computer running HA crashes while the relay is on).

Option 1 you need hardware that supports turning off automatically with a programmable delay, and you need the custom button card. Option 2 you’d need the code from this PR or some other method to have a button that can trigger an event upon release of the button.

Option 1 is from a technical point of view no problem. I could use the starlight function of an actor. This could be prgrammed between 1 and 50000 seconds.
But
Option 2 is what I want.
As I understand the conversation the of RomRider the project is not followed any more.
Or am I wrong?

I’m reading the same thing you are so I don’t have any special insight, but it appears to me the project is still active but the PR broke too many other things and was therefore reverted:

I’m not aware of another option for a button that sends an event upon release but that doesn’t mean one doesn’t exist.

Hopefully someone else can chime in with options.