Hi,
i tried to link two enocean switches and philips hue to one item but by some reason only one switch is working? strange think is its sometimes the 1. one and sometimes the 2 one.
Essentially, you cannot map one item to more than one binding and expect things to continue working.
While the items syntax may allow for this and while there may be instances where it seems to work out, there’s no general explicit logic implemented how openHAB is supposed to handle these cases. Use multiple items with one binding each, and create a rule to synchronize them.
Date is OH1, Datum is OH2 style. Both work reliable and as expected. (Of course either the former or the latter)
I think the main issue is, you try to use enocean two times at the same item.
The reason for the two enocean items is that i have multiple switches for the same light.
what i did now is setup the below items and rules. however if possible i would like to minimize it as much as possible.
rule "LR Ceiling light ON"
when
Item S_LR_Ceiling_D_E1 received command ON or
Item S_LR_Ceiling_D_E2 received command ON
then
sendCommand(S_LR_LIGHT_Ceiling_S, ON)
end
rule "LR Ceiling light OFF"
when
Item S_LR_Ceiling_D_E1 received command OFF or
Item S_LR_Ceiling_D_E2 received command OFF
then
sendCommand(S_LR_LIGHT_Ceiling_S, OFF)
end
rule "LR Ceiling light INCREASE"
when
Item S_LR_Ceiling_D_E1 received command INCREASE or
Item S_LR_Ceiling_D_E2 received command INCREASE
then
sendCommand(S_LR_LIGHT_Ceiling_S, INCREASE)
end
rule "LR Ceiling light DECREASE"
when
Item S_LR_Ceiling_D_E1 received command DECREASE or
Item S_LR_Ceiling_D_E2 received command DECREASE
then
sendCommand(S_LR_LIGHT_Ceiling_S, DECREASE)
end
rule "DR Ceiling light ON"
when
Item S_DR_Ceiling_D_E1 received command ON or
Item S_DR_Ceiling_D_E2 received command ON
then
sendCommand(S_DR_LIGHT_DiningTable1_S, ON)
end
rule "DR Ceiling light OFF"
when
Item S_DR_Ceiling_D_E1 received command OFF or
Item S_DR_Ceiling_D_E2 received command OFF
then
sendCommand(S_DR_LIGHT_DiningTable1_S, OFF)
end
rule "DR Ceiling light INCREASE"
when
Item S_DR_Ceiling_D_E1 received command INCREASE or
Item S_DR_Ceiling_D_E2 received command INCREASE
then
sendCommand(S_DR_LIGHT_DiningTable1_S, INCREASE)
end
rule "DR Ceiling light DECREASE"
when
Item S_DR_Ceiling_D_E1 received command DECREASE or
Item S_DR_Ceiling_D_E2 received command DECREASE
then
sendCommand(S_DR_LIGHT_DiningTable1_S, DECREASE)
end
The most common way would be to put all items into a group. Furthermore, there is a statement receivedCommand, so, 2 rules instead of 8 rules:
rule "LR Ceiling light"
when
Item S_LR_Ceiling_D_E1 received command or
Item S_LR_Ceiling_D_E2 received command
then
S_LR_LIGHT_Ceiling_S.sendCommand(receivedCommand)
end
rule "DR Ceiling light"
when
Item S_DR_Ceiling_D_E1 received command or
Item S_DR_Ceiling_D_E2 received command
then
S_DR_LIGHT_DiningTable1_S.sendCommand(receivedCommand)
end
With a group, as said before, you could reduce this to one rule, but I doubt it would be less code.
If there are much more switches and actuators - let’s say about 10 switches - one could get information about the last updated item (of the group, containing all switches) and then build the name for the actuator, which has to be updated.
I did use the method Item.sendCommand(State) as this is more reliable when using vars. See sendCommand() Documentation for details.