Basic lighting rule not working...need some help

So how does Private Boolean start as True?

What if you removed the PB altogether.

IF Illum <3000
and
time 5a-8a
then
On lights

ELSE-IF
Illum <3000
and
time 4p-11p
On Lights

ELSE-IF
time 11p-5a
OR
time 8a-4p
Off lights

ENDIF

So what I did is I removed the PB in the section that should be True now. Ran the rule and got the rule to set the PB False. Then I put it back in. Should be good now, I think. But I wonder how you get it to work right off the bat with the PB as an Condition?

I kind of thought the first ELSE-IF would change PB to false when it hits the time window and then when the second ELSE-IF hit it's time window it would change PB back to True??

Still isn't working right. The lights didn't go off last night. I am going to re-write this with the PB out and see what happens.

Fingers crossed. Maybe someone else can chime in and help you figure this out. I'm surprised no one has yet lately. Taking out the PB might be a logical solution.

Here is the rule as I have it right now. Logs show that it should have turned on the lights but it hasn't.

The Front Porch Lights events says that it turned on at 6:50pm but it didn't and the deck lights don't show anything turning on.

I'm about ready to give up on RM4 as I didn't have this problem in RM2.5 or 3.

You're making this more complicated than it needs to be. See PM.

If the Illuminance doesn't change at the exact time of 5PM it isn't going to work. Take out the time trigger.

I don't know what bravenel is giving you. I'm sure he will fix you up. But for the record I was trying to create this rule with multiple parts to get it to work for you. After it worked you could then shrink it down I'm sure. I like to give my rules individual parts so I understand what I'm doing, and it works, before I try to simplify it.

But wouldn't it still trigger because the triggers are one OR the other?

Yes but you already have times set in the IF and ELSE-IF statements. I wonder what would happen if you made each part an IF?

IF light<1000
and
time is 5a-8a
then
on lights
endif

IF light<1000
and
time is 4p-11p
then
on lights
endif

IF time is 8a
OR
time is 11p
then
off lights
endif

I can see your point and the way you have it laid out above might work. This is how @bravenel had me set it up. The first rule is a simple rule that deals with the lights coming on at 5:00am and going off at 11:00pm. This is a constant action that I want to happen each day.

This second rule deals with the Lux readings and he says "What these changes do is if the lights are already on but the lux hasn't hit the threshold yet, we don't need to keep sending on commands to them. Likewise with off. That's because Lux changing is going to keep on firing this rule after it's already done it's thing. So spare the mesh network the extra traffic."

Makes perfect sense when laid out like this!

1 Like

@pcgirl I didn't know you could put an IF inside an IF! I think I kinda get it but there is some areas I don't understand. The part I don't see is why he is turning on/off the lights in both rules?

First rule says to turn them on at 5a and off at 11p

Second rule says if time is between 11p and 5a then exit rule
If light level >1000
then if any On, turn them Off
Else
If any light is Off then turn them On (why this part?) (OK, I Get this Now) Still seems like it would still be sending whenever the light changes until it reaches 1000, on both sides of the 1000 ?? Up to 1000 and after 1000 OR is this what the IF inside an IF does, if so this is the part I am not getting.

You wanted things to happen from 5a-8a and 4p-11p which still leaves a time gap of 8a-4p not accounted for. Would that need to be added under the first exit rule statement above as:
IF Time between 8a-4p then Exit Rule?? Not sure

LOL Shocked me as well when I started really playing with RM4 :wink: Hands down my favorite feature so far.

The reason, how I understand it, is that he put the lights on turn off and vice versa so that it won't keep sending a lights ON to the lights. The time between 8am-4pm would be covered because the lux will be above 1000, unless it is a REALLY dark day! :stuck_out_tongue_winking_eye: This is a different way of looking at it and not a way that jumped out at me at first either.

You can nest IF's. You just have to follow the flow of the rule. And that is where confusion can set in.

@pcgirl Thanks, glad you got something that works. Sorry I couldn't help. I need to go read up on nested IF's. I hope there is documentation for it.

That looks like it'll work just fine. I think the big difference between that and the rules posted before is the IF light off, then turn on is replacing the PB logic. The point of both was to prevent constant firing commands to the lights.

RM4 has so many ways to achieve the same outcome!