# If - else if - else

Hi everyone! I have a small problem that I can’t solve and hopefully you can help. I’ve got an ikea remote (e1524) ja three ikea bulb’s. Remote has one button to toggle power on and off. I’ve added all devices to ST and they work correctly. In addition, I have a motion sensor that turns one of these lights on in case of movement. Problem occurs when movement has been detected (one light is on) and I press the power toggle on remote. In this case two other bulb’s turn on but one goes off. So what I need is somehow to check if one light is already on and only turn two others on. Or perhaps first power off the one and the turn all back on? I’ve studied IFTTT but at least the free version doesn’t seem to be able to solve this. webCoRE probably would but I guess it can’t be installed anymore? I’m new to ST so maybe there’s some other (obvious) ways to solve this that I don’t know about?

Take a look at the Sharptools Rule Engine. It will allow you to do complex automations based on if-then logic.

It sounds as if you need to evaluate the on-off status of one of the non-motion-sensor-affected lights and then apply the change to all three.

2 Likes

Thank’s a lot for the quick answer. I’ll study the Sharptools Rule Engine.

1 Like

I don’t have any IKEA bulbs so maybe I’m missing a problem, but if you have a Routine that upon motion turns on all three lights, I wouldn’t think it would matter that one of them was already on and it just turns all three on again?

If that doesn’t sound right, then maybe two separate Routines where one fires when all lights are off and the other fire is one one light is on?

EDIT: oh, I see the problem now, it is a power toggle button not an on button. Stinks that you have to have even more Routines, but I still think you could have three where you have none on, one on, or all three on.

You can do this in routines with Preconditions, but it will require two routines.

First example:
If desk light is off, turn on desk Light and office light.

Second example:
If desk light is on, turn on office light.

2 Likes

Thanks again for all the answers. Amazing who quickly you guys react. I’m impressed

1 Like

Have two routines bases on the status of one of non the motion controlled bulbs

Routine 1 : if bulb 1 is off and button is pressed turn on all three bulbs

Routine 2: if bulb 1 is on and button is pressed turn off all three bulbs

That way a button press always turns off all three or turns on all three.