Basic interface to create pulses


I’m trying to create a basic interface to create pulses to my impulse switches (Eltako). Using the configuration below, the switches are behaving like pushbuttons and all Eltako’s are reacting (so far, so good).

actual situation:
Switch GPIO2 “GPIO2” { gpio=“pin:2 activelow:yes initialValue:low”,expire=“0s,command=OFF” }
This GPIO is commanding a relay circuit which is connected to the Eltako modules.

The only issue I have, is on commanding the impulse switches with dimmable options. On these impulse switches I can not create a longer pulse to command the dimming. When changing the expire time to 1 sec, every pulse is seen as a long pulse (so the impulse switch goes EVERY TIME in to dimmable function)

I already tried setting the to 0.5s which is not supported.

Is there another solution to create a pushbutton which gives an output as long as it is commanded?

If possible, I would like to have the same type of pushbuttons for the normal impulse switches as for the dimmable impulse switches.

Thanks in advance for the support!

This is going to be very challenging to implement in OH. OH is event driven, not state driven.

There is no “button down state” that will keep something happening or changing while you keep pressing the button and then stop doing that when you stop pressing the button. You only have a button down event and a button up event.

You can probably code something up using proxy Items and Rules that might work because you can do almost anything in Rules. But it will probably be much easier and less work in the long run if you implement the GPIO stuff separately, perhaps in a Python script. Then you can send commands to this script from OH (MQTT is great for this) and handling the changing of the dimming and button press logic is implemented there.

Can you tell us a bit about what you want pulses to do, and how you hope to control them?

i.e. guessing maybe that a short “button press” toggles Eltako on/off, and a long “held button” causes dimming to cycle up and down until you release it?

If you are looking to recreate this from a UI, yo could separate the behaviour. One button on the UI simulates the short-pulse, via rule maybe. Another button could give you a press to start, press again to stop, with your “pulse” being held on inbetween.