Lights Off-Cancelable if Motion Sensor is Active

Ryan780

I have been studying the mode features because it makes more sense to use it but I can't seem to find where to set a mode between two times such as early morning from 6:00 am to 9:00. You have been a big help for me to understand the if then concept and the mode features. I love the trial and error and education with this. You are right, the more I play with it, the more it will make sense.

Ryan780, I think it's working this morning. The first two modes are registering just fine. I'll keep you posted. You have been great. I would never have figured this out without your help!

1 Like

My pleasure. Glad I could help.

Ryan780,

Thanks again for this "If then" explanation:

This of it this way....at each if, you have to make a binary choice....True or False (yes or now). If the answer is no, then you skip anything in the then and proceed to an Else-If and evaluate that (if there is one) or to an Else. If you have an ELSE statement, it will always be executed if the IF and all the ELSE IFs are false. So, because full with it. It means that something is always going to happen.

Once you start getting into "nested statements" with one inside another, you just have to remember what level deep you are. You bring yourself back to the previous level by using an END-IF.

Once it "clicks" you'll get it. Just keep plugging away. The more rules you look at and try to write, the quicker it will come.

All my lights are working because of your explanations and fixes on my rules. We have four teachers in the family and if you are not a teacher, then you should be. Pun intended. Thanks again!!:grin:

1 Like

I thought I had this figured out but the lights don't turn on when the motion is active, if I set the trigger to change then the light turns on when the motion is action and inactive. What am I not seeing.

You don't have the time periods nested below the Motion active. You have them at the same level because you used an Else-If. Change your first Else-If to a regular IF. Then put an End-If right above your Else, to close out the If part for the times with your lights. Then you've have the correct structure.

1 Like

Your time restrictions will never ever come into play.

Your trigger is Motion Active
This will ALWAYS be true, no exceptions
Thus only your Cancel Delayed Actions will ever come into play using your IF structures.

Using the same trigger you have:
Cancel Delayed Actions
Simple If Time1 Dim 100
Simple If Time2 Dim 40
Simple If Time3 Dim 20
Off Delay 3m Cancelable

  • 5 lines total!
1 Like

Thank you @Ryan780 and @GatVlieg for your help. I did as you suggested and so far so good!. Here's the final configuration.

1 Like

Looks good but you have a dead spot in your rule. If the motion is active and time is between 12:01 and 12:02 no action will occur. You could change the 12:02 in the second ELSE-IF to 12:01 or
you could change the second ELSE-IF to an ELSE. Either was should work fine.

1 Like

Your right, I saw that earlier but I forgot to fix it.

Since they are Else if, there's nothing wrong with having them overlap by one minute either. The first of the two will be the one that runs. So, you can have one end at 12:01 and the next begin at 12:01 and it won't cause an issue.

Yeah the overlap question is why I originally wrote it that way, wasn't sure If there would be a double trigger at the 12:01 time.

No, you don't actually. The end time take up to 59 seconds after the minute...so it triggers whenever the minute is equal to that. There is no rounding, it's truncated . So, if the time is 12:01:59.9999, the rule will still use the 2nd range because the time is still 12:01.

From bruce:

So, if 12:00 is the ending time, it will trigger until 12:00:59.9999.

Yours is correct. But there is nothing wrong with them overlapping if they are in else-if's, especially if you are in doubt about how they work.

1 Like

That isn't correct. If 12:00 is the ending time, it will trigger until 11:59:59.9999

If the time is single minute, not a range, then 12:00 is valid from 12:00:00 until 12:00:59.9999

Please read the post from Bruce I linked to above.

@bravenel, little backup please?
If your time range in a conditional action is 1:00- 2:00, will the last trigger point be:
a) 1:59:59.9999
b) 2:00:59.9999

Thanks!

It treats a single minute as a special case, where anytime within the 60 seconds is true. It treats a range of minutes such as 1:00 to 2:00 as true between 1:00:00.000 and 1:59:59.999.

Try this rule with times appropriate to what time it is:

Thanks for the confirmation!

1 Like

What do you consider the "ending minute" in your example?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.