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