dkaleita Posted May 27, 2009 Posted May 27, 2009 I'm trying to write a program (or set of programs) that will accomplish the following: At 30 minutes after sunset (except on Halloween), check to see if I've already armed my security system, and if so, turn on one scene (set of lights). But if the security system is not yet armed, then turn on two scenes. I am using my HAI OmniPro II (which unfortunately only talks X10) to transmit an X10 ON signal when I arm my security system, and an X10 OFF command when it is disarmed. I have a properly working ISY program that sets or clears a flag (enables or disables a program called "Security Night Flag") accordingly. I do a similar thing for detecting Halloween (October 31). I couldn't think of a way to do this in one program, so I wrote two: If Time is Sunset + 30 minutes And Program 'Security Night Flag' is True And Program 'Halloween Flag' is False Then Set Scene 'Outdoor Lights' On Else - No Actions - (To add one, press 'Action') If Time is Sunset + 30 minutes And Program 'Security Night Flag' is False And Program 'Halloween Flag' is False Then Set Scene 'Outdoor Lights' On Set scene 'Security Lights' On Else - No Actions - (To add one, press 'Action') My problem is that, every night at exactly 30 minutes past sunset, BOTH scenes get turned on regardless of the enabled/disabled state of 'Security Night Flag'. It all seems pretty straightforward to me. What am I missing? Or is my ISY-99 somehow malfunctioning?
Sub-Routine Posted May 27, 2009 Posted May 27, 2009 I have a properly working ISY program that sets or clears a flag (enables or disables a program called "Security Night Flag") accordingly. I do a similar thing for detecting Halloween (October 31). You should not be disabling the programs. Running Then turns the program True and running Else will set the program False. You don't need any actions in the program. Rand
dkaleita Posted May 27, 2009 Author Posted May 27, 2009 I never actually run the programs called "Security Night Flag" or "Halloween Flag"- I only check to see if they are enabled (flag set) or disabled (flag not set). The two programs/code samples in my post above are called, respectively, "30 Minutes After Sunset 1" and "30 Minutes After Sunset 2". They are NOT enabling and disabling themselves, if that's what you thought I was doing. For example, here are the programs, called "Security Night On" and "Security Night Off", respectively, that I am using to set and clear the "Security Night Flag' If X10 'A13/On (3)' is Received Then Enable Program 'Security Night Flag' Else - No Actions - (To add one, press 'Action') If X10 'A13/Off (11)' is Received Then Disable Program 'Security Night Flag' Else - No Actions - (To add one, press 'Action') Are you saying that I should not be using Enable and Disable, but rather, run them as Then or Else, as appropriate? Would this explain the malfunction that I am experiencing?
Sub-Routine Posted May 27, 2009 Posted May 27, 2009 Hello dkaleita, I'm sorry if I was confusing. When you check for True or False is does not matter if the programs are enabled or not. When your program sees the X10 command for the security system armed you should Run (Then) "Security Night Flag". When unarmed Run (Else) "Security Night Flag". This will set the program True: If X10 'A1/On (3)' is Received Then Run Program 'Security Night Flag' (Then Path) Else - No Actions - (To add one, press 'Action') This will set the program False: If X10 'A1/Off (11)' is Received Then Run Program 'Security Night Flag' (Else Path) Else - No Actions - (To add one, press 'Action') You can check the status of the programs on the Program Summary page. I never actually run the programs called "Security Night Flag" or "Halloween Flag"- I only check to see if they are enabled (flag set) or disabled (flag not set). The two programs/code samples in my post above are called, respectively, "30 Minutes After Sunset 1" and "30 Minutes After Sunset 2". They are NOT enabling and disabling themselves, if that's what you thought I was doing. Am I missing you point, or are you missing mine? Some of each I think Rand
dkaleita Posted May 27, 2009 Author Posted May 27, 2009 Ah, I see! I guess I had a basic misunderstanding of how to implement a flag. I'll give it a try.
Recommended Posts