Hi Guys
I have a rule which cycles through colours on my Yeelight RGB Strip which while working could be allot simpler. I was hoping someone might be able to point me in the right direction to make the rule simpler/more compact. I’m not a good coder but once I have a working example I can work through it so any help would be greatly appreciated.
rule "Kitchen LED Party Mode"
when
Item Kitchen_Party_Mode changed from OFF to ON
then
if (KitchenYeelightLEDStripTest_Power.state == ON) {
while (KitchenYeelightLEDStripTest_Power.state == ON && Kitchen_Party_Mode.state == ON) {
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"0,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"10,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"20,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"30,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"40,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"50,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"60,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"70,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"80,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"90,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"100,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"110,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"120,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"130,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"140,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"150,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"160,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"170,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"180,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"190,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"200,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"210,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"220,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"230,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"240,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"250,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"260,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"270,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"280,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"290,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"300,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"310,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"320,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"330,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"340,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"350,100,100")
Thread::sleep(1500)
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"359,100,100")
Thread::sleep(1500)
}
sendCommand(KitchenYeelightLEDStripTest_RGBColor,"0,0,100")
}
end