JohnnyX
(John)
January 13, 2018, 12:52pm
1
Windows 10 64 bit
OH2.2 (release build)
Bindings: knx, zwave, comfoair, caldav
Persistence: mysql
Dear all
I would like to steer the fan of my ComfoAir (air exchange system) both in OH and KNX.
steering the fan speed of my ComfoAir (has levels; 1, 2, 3 and 4) via OH2.2 this works perfectly fine
steering via KNX does not work (yet) - this is the part where I need your help
The fan steering via OH is done with a setpoint item:
Setpoint item=Lueftung_Fan_Level step=1 minValue=1 maxValue=4
That means: pushing the + or the - of the setpoint item increase or decreases the fan level.
In KNX I have only one item to steer the fan:
Lueftung_manuell_steuern
This item sends either ON or OFF which means:
ON = 1 = increase one level
OFF = 0 = decrease one level
How can I map ON/OFF to the Plus/Minus of the setpoint item?
Thanks & best regards
John
JohnnyX
(John)
January 13, 2018, 3:08pm
2
Meanwhile I helped myself with the following rule. Maybe there is a more elegant way to solve it?
rule "KNX to openhab to ComfoAir"
when
Item Lueftung_manuell_steuern received command
then
if(receivedCommand == ON && Lueftung_Fan_Level.state == 1) {Lueftung_Fan_Level.sendCommand(2)}
if(receivedCommand == ON && Lueftung_Fan_Level.state == 2) {Lueftung_Fan_Level.sendCommand(3)}
if(receivedCommand == ON && Lueftung_Fan_Level.state == 3) {Lueftung_Fan_Level.sendCommand(4)}
if(receivedCommand == OFF && Lueftung_Fan_Level.state == 4) {Lueftung_Fan_Level.sendCommand(3)}
if(receivedCommand == OFF && Lueftung_Fan_Level.state == 3) {Lueftung_Fan_Level.sendCommand(2)}
if(receivedCommand == OFF && Lueftung_Fan_Level.state == 2) {Lueftung_Fan_Level.sendCommand(1)}
end
rule "KNX to openhab to ComfoAir"
when
Item Lueftung_manuell_steuern received command
then
if(receivedCommand == ON && Lueftung_Fan_Level.state < 4) Lueftung_Fan_Level.sendCommand(Lueftung_Fan_Level.state as Number) + 1)
else if(receivedCommand == OFF && Lueftung_Fan_Level.state > 1) Lueftung_Fan_Level.sendCommand(Lueftung_Fan_Level.state as Number) - 1)
end
Be aware that this rule will cause an error if Lueftung_Fan_Level.state
is not an instance of Number (for example when openHAB is started and there was no state initialization of this item yet, so either use persistence and restoreOnStartup or initialize by reading the state at startup.
1 Like
JohnnyX
(John)
January 14, 2018, 3:14pm
4
Thanks @Udo_Hartmann , that’s indeed much more clever
I’m using a persistence for the mentioned 2 items anyway.
Best regards
John
Ah, one mistake… I don’t know if openHAB is more tolerant to this… As a state is a state and not a number, the if clause should be like
if(receivedCommand == ON && (Lueftung_Fan_Level.state as Number) < 4)