Unintentional loop from If statement


#1

Hi,

Sorry for the noob questions but can’t get my first piston to run properly and not sure if the behaviour is expected from my piston or an error.

I have created a piston that I want to run externally by triggering the URL of the piston. It should then check for the state of my hue bulbs and either turn on or off. In both cases, the piston just loops until I pause it, turning the bulbs on and off. I get the “Waiting for Semaphore” message in the logs.

Any advice on what I could be doing wrong?


#2

Pull the IF statement out of the do statement.
Change the condition from is any to is
Click on the first IF, select the settings cog, change the subscription to never. (This will make it so the piston is executed only externally)


#3

Thanks @c1arkbar

Didn’t know about the subscription hence why I put it in a do statement. I need the ‘is any’ as not all bulbs will be on at the same time and I would like them all to ‘turn off’ if only one of them is on, would that break it?


#4

No worries. We are all learning.

If you check out the entire line

“Any of rgb 3, rgb 4, rgb 5 switch is any of on”

This first ANY is going to check all the devices following it.
The second any would be checking possible switch states. With the is any of you would use that for multiple options. Since you only have 1 option you would just use is