Jump to content

What's wrong with this program?


ryarber

Recommended Posts

Posted

I'm trying to get the landscape lights to come on at about 10 minutes past sunrise unless it's cloudy. Here is my program

 

If

When time is sunset

and Module 'Climate' Light is 0

 

Then

Set Scene 'Landscape Lights' On

 

Else

Wait 10 minutes

Set Scene 'Landscape Lights' On

 

 

I'm getting landscape lights turning on at various times during the day. Even during daylight.

Posted

I suspect you are either getting dark cloud cover or someone is setting something on or over the light sensor of the weather station you are using. That's causing the light level to reach 0, which triggers evaluation of your program. Since the result is False (because it isn't Sunset), it executes the Else statement.

 

Easily solved by splitting this into multiple programs:

 

 Sunset timer

If
       Time is Sunset 
Then
       Run Program 'Landscape Lights' (If)

Else
  - No Actions - (To add one, press 'Action')

 

 Landscape Lights
If
       Module 'Climate' Light is 0 

Then
       Set Scene 'Landscape Lights' On

Else
       Wait  10 minutes 
       Set Scene 'Landscape Lights' On

Posted

how does splitting it help? His if is sunset AND light at 0. You seem to describe the problem as if its executing in an OR method.

Posted
how does splitting it help? His if is sunset AND light at 0. You seem to describe the problem as if its executing in an OR method.

That's exactly the effect of the original program, although with respect to the ELSE part, not the THEN part. Remember that individual components of the IF are evaluated whenever they happen. So the evaluation of Light value happens indepedently of whether it's sunset or not, and the program continues accordingly.

 

So, yes, the original conditions are ANDed. But this also means that the inverses are ORed: If either condition is FALSE, then the whole condition is FALSE and the ELSE part of the program runs. In this case, any time the climate module spits out an event that says the light value is not 0, then the Landscape Lights will come on 10 minutes later via the ELSE part of the program.

Posted

Whoops, neglected to mention that my second program has to be disabled to prevent the same problem from happening when the climate module says the light level is NOT 0!

 

Thanks, Markens, for pointing that out.

Posted

Thanks for the help. I didn't realize that if the first statement was false, the program would be evaluated. I had assumed that with the first statement being a timed event, it would force the program to only be evaluated once daily.

 

I guess else statements can get you in trouble unless you know what you are doing.

Guest
This topic is now closed to further replies.

×
×
  • Create New...