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.