Jump to content

Programs using parentheses issues


mcqwerty

Recommended Posts

Posted

I am trying to control the lights in my closet with hidden door sensors on each of the two doors to/from the closet.

 

2x 2845-222 configured as two nodes each in each door

1x 2477D controlling the load on the lights

ISY994ZW 4.2.18 Firmware

 

The 2477D is between the two sensors and there is less than 5' from sensor to switch.

 

I am trying to set up the system so the lights will come on if EITHER door is opened and only go off if BOTH doors are closed.

 

Making the lights come on is simple with a single scene containing the two 'Door Open' nodes as controllers and the switch as a responder.

 

Making the lights turn off has proven more of a challenge.

I wrote a program to control this and is shown below:

If
        (
             Control 'Main Floor / Master Closet / Master Bathroom Door Sensor / Door Closed' is switched On
         And Status  'Main Floor / Master Closet / Family Foyer Door Sensor / Door Closed' is 100%
        )
     Or (
             Control 'Main Floor / Master Closet / Family Foyer Door Sensor / Door Closed' is switched On
         And Status  'Main Floor / Master Closet / Master Bathroom Door Sensor / Door Closed' is 100%
        )
 
Then
        Wait  1 second
        Set 'Main Floor / Master Closet / Can Lights' Off
 
Else
   - No Actions - (To add one, press 'Action')
 

This does not work as desired.

 

But, if I copy the program above twice, and edit each as below:

If
        (
             Control 'Main Floor / Master Closet / Master Bathroom Door Sensor / Door Closed' is switched On
         And Status  'Main Floor / Master Closet / Family Foyer Door Sensor / Door Closed' is 100%
        )
 
Then
        Wait  1 second
        Set 'Main Floor / Master Closet / Can Lights' Off
 
Else
   - No Actions - (To add one, press 'Action')
 

and 

If
        (
             Control 'Main Floor / Master Closet / Family Foyer Door Sensor / Door Closed' is switched On
         And Status  'Main Floor / Master Closet / Master Bathroom Door Sensor / Door Closed' is 100%
        )
 
Then
        Wait  1 second
        Set 'Main Floor / Master Closet / Can Lights' Off
 
Else
   - No Actions - (To add one, press 'Action')
 

then I get the desired behavior.

 

I know the parentheses are not required in the two split programs, but I left them in to verify they were not causing a problem.

 

Why does my single program not behave as I expect?

 

 

 

 

 

Posted (edited)

I think I have answered my own question. Writing the original post helped me think it through.

I think the problem is a combination of using 'Control' rather than 'Status' and also introducing the 1 second wait.

 

I assume that while the Control will trigger the program and the wait will begin, at almost the same moment, the Status will also change which re-runs the program and cancels the wait. Since when the status changes, the Control of the other door has not changed, then neither logic path equates to TRUE and hence the 'Then' is never triggered.

 

I changed my program to:

If
        Status  'Main Floor / Master Closet / Family Foyer Door Sensor / Door Closed' is 100%
    And Status  'Main Floor / Master Closet / Master Bathroom Door Sensor / Door Closed' is 100%
 
Then
        Wait  1 second
        Set 'Main Floor / Master Closet / Can Lights' Off
 
Else
   - No Actions - (To add one, press 'Action')
 

and all is well.

 

Hope this helps someone else in the future :-)

Edited by mcqwerty
Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

    • There are no registered users currently online
  • Forum Statistics

    • Total Topics
      37.1k
    • Total Posts
      371.6k
×
×
  • Create New...