Sync Hue Lights Rule

Hi there,

this is my first post in this forum and normally I try to resolve such problems by myself but this time I would like to ask you guys…
I have Setup openHABian on an RPI 3+ and its running fine, but I dont get why my rule is not working as expected.
I have several Hue Color Lights and this Rule:

rule "Color Sync an"
when
  Item Home_Color_Sync changed to ON
  then
        AT_Studio_Play_R.sendCommand(AT_Studio_Play_L.state as HSBType)
        OU_Balcony_LED_L.sendCommand(AT_Studio_Play_L.state as HSBType)
        OU_Balcony_LED_M.sendCommand(AT_Studio_Play_L.state as HSBType)
        OU_Balcony_LED_R.sendCommand(AT_Studio_Play_L.state as HSBType)
        AT_Studio_Stand.sendCommand(AT_Studio_Play_L.state as HSBType)
        GF_Bedroom_Stand.sendCommand(AT_Studio_Play_L.state as HSBType)
        GF_LivingRoom_Stand.sendCommand(AT_Studio_Play_L.state as HSBType)
end

rule "Color Sync Play L"
when
  Item AT_Studio_Play_L received update
  then
    if (Home_Color_Sync.state==ON) {
        AT_Studio_Play_R.sendCommand(AT_Studio_Play_L.state as HSBType)
        OU_Balcony_LED_L.sendCommand(AT_Studio_Play_L.state as HSBType)
        OU_Balcony_LED_M.sendCommand(AT_Studio_Play_L.state as HSBType)
        OU_Balcony_LED_R.sendCommand(AT_Studio_Play_L.state as HSBType)
        AT_Studio_Stand.sendCommand(AT_Studio_Play_L.state as HSBType)
        GF_Bedroom_Stand.sendCommand(AT_Studio_Play_L.state as HSBType)
        GF_LivingRoom_Stand.sendCommand(AT_Studio_Play_L.state as HSBType)
   }
end


rule "Color Sync Play R"
when
  Item AT_Studio_Play_R received update
  then
   if (Home_Color_Sync.state==ON) {
        AT_Studio_Play_L.sendCommand(AT_Studio_Play_R.state as HSBType)
        OU_Balcony_LED_L.sendCommand(AT_Studio_Play_R.state as HSBType)
        OU_Balcony_LED_M.sendCommand(AT_Studio_Play_R.state as HSBType)
        OU_Balcony_LED_R.sendCommand(AT_Studio_Play_R.state as HSBType)
        AT_Studio_Stand.sendCommand(AT_Studio_Play_R.state as HSBType)
        GF_Bedroom_Stand.sendCommand(AT_Studio_Play_R.state as HSBType)
        GF_LivingRoom_Stand.sendCommand(AT_Studio_Play_R.state as HSBType)
   }
end

When it was only one rule it worked, but now the color is not changing at all.
In the documentation it says when I “sendCommand” it does not trigger “received update” … But I think this triggers for every rule on every change now…
What can I do? I want to have the ability to chose the color from any “Sitemap ColorLight” and send this to the others.

Your reading of the docs is incorrect. When you send a command, that doesn’t immediately update the Item itself. However, by default there is a feature called “autoupdate” that is enabled by default that will make an educated guess as to what state the Item will change to in response to the command (e.g. sending an INCREASE command might result in the Item moving to state 20). THAT will be an update and possibly a change as well.

If you have autoupdate configured to false on that Item, you still might get an update in response to a command. When the device does what ever it is commanded to do it might report it’s new state back to the binding which will result in an update to the Item.

You appear to have an infinite loop here and it appears to do nothing because you are overloading the binding with commands. Always look at the logs to see what is going on.

To make this work, you need to use a proxy Item and write a Rule to send changes to the proxy to all of the lights. Or you might be able to make it work by putting all the Lights into a Group and sendCommand to the Group which will get forwarded to all of the members of the Group.

1 Like

I finally realized that this is the problem when the lights started changing colors some minutes later …
The proxy item is what I needed, thank you very much!