I have hardware switches to steer KNX dimmable lights. If I push short it switches on and off, if I push long it is dimming the lights.
If I implement the same via OpenHAB switch and dimmer items I have the issue that the two elements interfere. These is because for the switch KNX gives feedback on the state on the Group-address (GA) of the switch that sends the commands. For the Dimmer I get e second response from KNX with a percentage value. So if I switch on with the Dimmer Item e.g. to 30% I receive two feedbacks. 1. 30% and secondly “ON” wich has by default a value of 90%. I defined 3 rules to overcome the situation.
They implement that I cannot put on and turn off the lights with the Dimmer Item anymore. (Wich Is pretty much the same the hardware switch does. If I push the switch long to put on the lights, it goes to 90% and does not start dimming. To dimm I have to push it a second time)
In my case only the Dimmer Item is connected to the respective KNX Light Thing. The Switch Item is only connected to the rules.
My question: Is that the simplest way to implement a Switch and a Dimmer Item for the same KNX Thing without an interference of the KNX feedbacks or is there a simper way?
Here my rules (I know that the on and off rules could have been be written in one rule)
rule “Büro_D_an”
when
Item Buero_D changed to ON
then
Buero_D_Dim.sendCommand(90)
end
rule “Büro_D_aus”
when
Item Buero_D changed to OFF
then
Buero_D_Dim.sendCommand(0)
end
rule “Büro_D_Dim”
when
Item Buero_D_Dim changed
then
if (Buero_D.state == OFF) Buero_D_Dim.sendCommand(0)
else if (Buero_D_Dim.state==0) Buero_D_Dim.sendCommand(5)
end