Jump to content

Program Problem


smokegrub

Recommended Posts

I want the BuzzLinc to buzz 3 times when either of 3 hidden door sensors are open between sunset and sunrise the next day. The buzzer sounds whenever a door is opened, i.e., it is unrestricted as to the timeframe. What am I doing wrong?

 

If
        From    Sunset
        To      Sunrise (next day)
    And Status  'Door Sensors / Deck Door Sensor' is On
     Or Status  'Door Sensors / Kitchen Door Sensor' is On
     Or Status  'Door Sensors / Man Cave Door Sensor' is On
 
Then
        Repeat 3 times
           Set 'BuzzLinc' On
           Set 'BuzzLinc' 2 (Beep Duration)
           Set 'BuzzLinc' Off
 
Else
        Set 'BuzzLinc' Off
 
 

Link to comment

Need Parens so time range applies to all Sensors

 

If
        From    Sunset
        To      Sunrise (next day)
    And

    (

 

          Status  'Door Sensors / Deck Door Sensor' is On
     Or Status  'Door Sensors / Kitchen Door Sensor' is On
     Or Status  'Door Sensors / Man Cave Door Sensor' is On
    )
Then
        Repeat 3 times
           Set 'BuzzLinc' On
           Set 'BuzzLinc' 2 (Beep Duration)
           Set 'BuzzLinc' Off
 
Else
        Set 'BuzzLinc' Off

Link to comment

Also if the BuzzLinc should alert ONLY when door is Opened and NOT if door remains Open then use If Control

 

If
        From    Sunset
        To      Sunrise (next day)
    And

    (

 

          Control  'Door Sensors / Deck Door Sensor' is switched On
     Or  Control  'Door Sensors / Kitchen Door Sensor' is switched On
     Or  Control  'Door Sensors / Man Cave Door Sensor' is switched On
    )
Then
        Repeat 3 times
           Set 'BuzzLinc' On
           Set 'BuzzLinc' 2 (Beep Duration)
           Set 'BuzzLinc' Off
 
Else
        Set 'BuzzLinc' Off

Link to comment

Generally Parens are needed when the If has both Or and And statements.  The Parens bracket a set of conditions, a group of Ors or a Group of Ands that then need to be Ored or Anded with something else.  Without the Parens some of the Ored conditions operate without benefit of the time range.  The Wiki has some examples that may be helpful. 

Link to comment

Archived

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


×
×
  • Create New...