One switch - multiple switch and dimmer function

Hello Guys.
I have some KNX switches installed I wanna connect to some Hue Devices… after looking around and asking it seems to be the best solution to control it through a Rule.

My knx devices can handle to send different switch signals depending on the numbers of time pressed - but that can’t be combined with dimmer function…

So I was wondering if anyone could lead me in the direction for doing this in a rule instead, so the knx device only sends on/off to openHab, and that one then evaluates number of presses, and long time press for dimming - and also an item remembering the dimmer direction …

Seems pretty easy to trigger a rule every time a new command is received, but I can’t figure out how to sum the amount of presses - and also ensure only one rule is triggered - so I don’t get many of them running parallel…

It would be easiest if your KNX switches would send commands on different GAs depending e.g. on the number of times they have been pressed.

If you want to do this in a rule this rule must be triggered every time the switch is pressed (or released). The rule must determine the time since the last trigger. This could be done by starting a timer whenever the rule is triggered and checking if this timer has elapsed on the next trigger and before triggering it again.

As long as the timer has not elapsed you keep accumulating events and if it elapses you trigger an action based on the number of accumulated events (and reset the count). This should be done in the function called when the timer elapses.

For dimming I would keep it simpler, like increasing the brightness by a fixed step every time the switch is pressed.

But first of all I would check the documentation of your switches. I find it hard to believe that a. odern KNX switch can not send dimming telegrams. Maybe you have to use an other application for the switch.

1 Like

My switch can send either dimmer telegrams or it can summarize and send different GA’s depending on the times the button was pressed - but it can’t use both of these above - that’s what I am missing :slight_smile:

So mainly yes, a rule is triggered that determines the function the button is pressed at, to summarize or do dimming jobs - then it will trigger different rules if either a sum job or a dimmer job…

And then a timer will reset the sum…
the sum should then be a “global” item that is retained …

Then it’s not a problem that the rule is triggered many times… only the first on create the timeout timer…

Then it’s not a problem that the rule is triggered many times… only the first on create the timeout timer…

I would (re) trigger the timer every time the switch is pressed, otherwise the timer may elapse when a “slow” person is not “finished” pressing the switch.

The rule which is invokes by the KNX telegram can check the status of the timer and react accordingly.