If Then Else in Core?


(Erwenger) #1

I can’t ever seem to get an IF Then Else Rule to work properly in Core.

Here is an example.

I have motion detector on the steps down to my basement theater. If there is motion on the steps, a light is supposed to go on.’

BUT if the projector is on, I want something else to happen (let’s say it should only dim to 25% and turn blue).

The IF part works fine. So, currently, if the projector is off (and I test that using virtual swich that gets thrown on or off when the projector turns on or off), then the light goes on. And otherwise nothing happens. But I’d prefer to have an ELSE or ELIF that then triggers teh 25% dim blue light. Doesn’t work.

No idea why!?!?!?


#2

I’d suggest giving webCoRE a try. It’s much easier to construct pistons now and share. I can try and put one together for you and import it in webCoRE after you get it installed.


( I hate Mondays) #3

If Then Else is by definition a single condition with two decisional paths, one for true, one for false. You clearly need two conditions (motion and projector). You can do that in CoRE by enabling expert mode and using a THEN IF grouping method (add a condition group and two conditions in it, then click on the AND between them and change it into a THEN IF) and use when true/when false individual actions on the second conditions.

Or… you could skip CoRE and dive into webCoRE (which is bound to replace CoRE once it’s out of beta). More info here: [DEPRECATED THREAD] webCoRE Beta Milestone 1

If you install webCoRE, you can even import this piston below (add new piston and use the orange option) and just select your motion sensor, your projector switch, and your bulb…


#4

And there you have it, I willed it and it’s done! lol


(Erwenger) #5

Yes. I was thinking it through more and I came to this conclusion. I need a step for when motion is detected. And then I need two branches for motion that is dependent on whether the projector is on or not. Thx.

Get Outlook for iOShttps://aka.ms/o0ukef


(Erwenger) #6

Wow! Very cool. Installed. Will try it out. Not sure how “testing” works in the app though. Can you simulate a motion event and then step through the actions? Also, not sure I follow the purpose of the 2 minutes and turn off.

I tweaked yours a bit. (

). Ideally, I’d like to do this:

  1. If motion then:
    a) If projector on, turn on dimmer light to 10%, wait 2 minutes, then turn off
    b) if projector off, turn on dimmer to 100%, wait 15 minutes, then turn off
  2. if no motion, then do nothing.

Thanks!


(Michael Sammon) #7

you could even do this with regular core

in actions you can say only do this action if the switch is off
and another if off

then for else(no motion)
if off wait 15 turn off
dont forget to include a cancel action on piston state change


(Erwenger) #8

I must say that while I love the look of the interface, as a person with fairly limited programming skills, I’m a little lost in actually using it. So, here again is the current state of the piston:MAIZ

I want to now add a couple of things…and would love instructions on where and how. So please “teach a man to fish!”

  1. I would like to add a second “else” condition inside the area where it is turning on the bulb to 100% (i.e., when the switch keeping track of when my projector state shows that it is off—and no one will be disturbed by the light). If it is late at night (say after 11 PM), I would like to also set the light to a level less than 100 before turning on).
  2. Am I supposed to click on “show complex ifs”
  3. Then it looks like I would click on “add new condition under elseif”
  4. I think then I want to link the action to some variable related to time (Say that time is between 11 PM and 8 AM), but now I’m lost.

Advice? THx.