HUE and Ikea

hello everyone,
i am trying to use simple rules to set colors to several lamps with hsb.
some of the lamps sometimes dont show the right color. for example i am
send the same hsb to three ikea lamps and 2 show the same color and 1
does not ?
Color li_stehl_1 “li_stehl_1” (g_li_stehl) { channel = “hue:0200:0017886b76ad:12:color” }
Color li_stehl_2 “li_stehl_2” (g_li_stehl) { channel = “hue:0200:0017886b76ad:13:color” }
Color li_stehl_3 “li_stehl_3” (g_li_stehl) { channel = “hue:0200:0017886b76ad:14:color” }


rule “TV stimmung ein”
Item tv_stimm received command ON
sendCommand(li_tv, “23,100,28”);
sendCommand(li_ku_1, “328,33,28”);
sendCommand(li_ku_2, “328,33,28”);
sendCommand(li_ess, “328,33,28”);
sendCommand(li_esstisch1, “328,33,28”);
sendCommand(li_esstisch2, “328,33,28”);
sendCommand(li_esstisch3, “328,33,28”);
sendCommand(li_kueche, OFF);
sendCommand(li_eg_vz, OFF);
sendCommand(li_kueche_a, OFF);

any idea why the bulbs dont act as they should ?

thanks for every help

Just a remark, please use code fences when posting code or log files, it makes them much easier to read: How to use code fences

And now to your question, Hue and Ikea hubs are not the fastest ones. I don’t have the specs for Ikea, but the Hue hub is specified to only one command every 70 or 100ms (don’t remember exactly). What I need to do in a similar setting to yours is to add a Thread::sleep(100) statement after each sendCommand statement (in a new line) to ensure that the hub has enough time to digest every command.
A word of caution: this has the disadvantage of making your rules slow to execute and if you have many rules that get activated can cause other problems. So ultimately, you may need to work with timers. for more details see here: Why have my Rules stopped running? Why Thread::sleep is a bad idea

You can avoid the long running rules by using Design Pattern: Gate Keeper

1 Like

Thanks a lot for your help, i will read those links and try my best
to make a smart solution and sorry for the missing fences, i will remember
that next time.

just a question @lipp_markus: due to hue is a “slow” working hub, can this be
the reason that sometimes it takes about 3 seconds that the rule starts working ?


Not sure that you can explain 3s delay by the fact the hue bridge needs time between commands. You may want to look at what triggers your rule, ie.e, when exactly does this item change state. A couple of loginfo statements may help together with the comparison what events are actually recognized in OH2 (e.g., by comparing timestamps in the event.log with your openhab.log if you are adding the loginfor statements mentioned above