Jump to content

ISY programming question


jruben4

Recommended Posts

I wasn't clear on this from the wiki -

 

 

I want to make a program that IF it's dark out AND either one of two zones is violated THEN turn on some lights.

 

IF

Time between dusk and dawn

AND

(Zone 1 violated OR zone 2 violated)

 

 

Not sure how to get the AND/OR correct.  Probably something with the AND (...) buttons but wasn't sure how to get this to work.

Thanks!

Link to comment

You're pretty much there.  

  • Start with the sunset to sunrise (next day).
  • Add the zones. I would use control to catch them going on, but you may want to use status in case that they are on. They may be from an elk, use whatever statements tell you that the zone is violated.
  • Then add the Add And (..)  using the buttons on the right in the admin console. Use the Move Line Up button on the left to put the parens around the code for the zones:

You'll want And, because both things need to be true. Using Or, either event will cause the program to run, which doesn't meet your requirement.

New Program Copy - [ID 004B][Parent 0001]

If
        From    Sunset 
        To      Sunrise (next day)
    And (
             'Zone' is switched On
         And 'Zone' is switched On
        )
 
Then
   - Your Stuff

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

Paul

Link to comment

I wasn't clear on this from the wiki -

 

 

I want to make a program that IF it's dark out AND either one of two zones is violated THEN turn on some lights.

 

IF

Time between dusk and dawn

AND

(Zone 1 violated OR zone 2 violated)

 

 

Not sure how to get the AND/OR correct.  Probably something with the AND (...) buttons but wasn't sure how to get this to work.

Thanks!

 

 

Just the way you wrote it but one condition per line.

 

IF

        From sunset

        To sunrise (next day)                     <----Time between dusk and dawn

AND (

           Zone 1 violated

    OR zone 2 violated

         )

 

Then

   ....

 

Click on the And() or Or() and slide them up or down to where you want.

 

EDIT: Sorry Paul. I formulated this post and then the doorbell rang after which I hit Post. LOL

Link to comment

I run a lot of  test programs to try things out. Use a beeper or even a program to indicate the code is being executed.

 

 

Test Indicator (Not enabled)

If

    --

Then

     Wait 1 second

     Run program 'Test Indicator' (else)

 

Else

   ---

 

Now when you insert the line in your programs Run program 'Test Indicator' (If)' you will see the program icon turn to red and back every time YOUR ISY program passes through that point.

 

When you are sure about your program, remove the test line.

 

NOTE: You have to have your icons colours enabled for this. This is a right click option on the program tree.

post-4697-0-10566800-1449418530_thumb.jpg

Link to comment

Archived

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


×
×
  • Create New...