Jump to content

Operator precedence in a program


Recommended Posts

Posted

I assume the below will do what I want? If either of 3 motion sensors is triggered and it's between 11:00 PM and Sunrise then trigger the Front Lights. I tried it with output B, I've just never used the parenthesis before.

 

TIA

 

Front Motion Test - [iD 0009][Parent 0001]
 
If
        (
             Status  'EZIO8SA - B' is On
          Or Status  'EZIO8SA - A' is On
          Or Status  'EZIO8SA - 9' is On
        )
    And From    11:00:00PM
        To      Sunset  (next day)
 
Then
        Set Scene 'Front Lights' On
        Wait  2 minutes 
        Set Scene 'Front Lights' Off
 
Else
   - No Actions - (To add one, press 'Action')
 
 

 

Posted

Remember, it's event driven. Every time the status of anything in 'If'' changes, the entire If is evaluated and either 'Then' or 'Else' is run.

 

Does not matter for this program, but be aware that at 11:00:00PM and at Sunset (next day) the 'Else' branch will run even if the motions status does not change.

 

The other thing, the wait in the 'Then' branch will be aborted if any 'If' condition changes during the wait period. Again, likely not an issue for this program...

Posted

Again, likely not an issue for this program...

The time this could be an issue is when the timer is active when sunrise occurs. In such a case, the.lights.will remain on.

 

Your program also has "sunset" rather than "sunrise".

Posted

Remember, it's event driven. Every time the status of anything in 'If'' changes, the entire If is evaluated and either 'Then' or 'Else' is run.

 

Does not matter for this program, but be aware that at 11:00:00PM and at Sunset (next day) the 'Else' branch will run even if the motions status does not change.

 

The other thing, the wait in the 'Then' branch will be aborted if any 'If' condition changes during the wait period. Again, likely not an issue for this program...

Yeah, I was considering using the Else as a fail-safe to turn off the Scene in case something went  wrong. 11:00 PM and SunRise (not SunSet) would actually work, but I assume the Else would fire any time all of the motion sensors were off.

 

The Wait does not work, at least I know why now.

 

I assume the best way to get around this is to set a variable that launches another program and put the wait in there?

The time this could be an issue is when the timer is active when sunrise occurs. In such a case, the.lights.will remain on.

 

Your program also has "sunset" rather than "sunrise".

Yes, s/b sunrise, as I discovered this morning.

 

thanks

Posted

Yes, the else would fire when motion sensors turn off. For this reason, I prefer "control" rather than "status" conditions here.

 

Yes, I would include lights off command in the else path.

 

No need to set a variable to launch another program. An unnecessary complication, in my mind.

Posted

Yes, the else would fire when motion sensors turn off. For this reason, I prefer "control" rather than "status" conditions here.

 

Yes, I would include lights off command in the else path.

 

No need to set a variable to launch another program. An unnecessary complication, in my mind.

Yes, but the variable would make it event driven, so I could use the same code snippet to turn the Scene off in other situations.

 

Got an example of using Control? 

Posted

 

Got an example of using Control?

 

Use your same program logic and steps but update each "status" condition to "control". I believe that this is a selection from the drop-down box.

Posted

Use your same program logic and steps but update each "status" condition to "control". I believe that this is a selection from the drop-down box.

Yep, I did a little reading.  :oops:

 

So the control maintains it's true state once the event occurs, whereas the status is only true when the motion sensor is activated. Hence the Wait fails.

 

Thanks

Posted

A control-on condition is triggered only by receipt of the ON command. A status-on condition is triggered by any change of state, from on-to-off, or off-to-on.

Posted

Furthermore, I suspect you have flipped state conditions of control vs status. Status-on remains true until off. Control-on is true only at the moment of trigger.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...