aLf Posted October 20, 2010 Posted October 20, 2010 I'm getting a continuous loop On then OFF trying to do a simple program. What I'm trying to do is... Outlet ON at sunset Lanterns on at sunset I'd like ISY to watch over the program similar to this. But the parenthasis thing seems to make it loop. IF time is between sunset and 10:30 PM same day and outlet is OFF or lantern is OFF Then turn outlet ON and turn lantern ON If I can get this to work, I can do the opposite for the time between 10:30 PM and sunset the following day for the "forced" OFF call. I know this is basic to you guys, I appreciate the help. aLf
Mark Sanctuary Posted October 21, 2010 Posted October 21, 2010 The thing about the ISY programming is it can easily loop back on itself when you try to check something your going to change. In order for this to work without issue you will have to do it like this... If From Sunset To 10:30:00PM (same day) Then Set 'Outlet' On Set 'Lantern' On Else Set 'Outlet' Off Set 'Lantern' Off And to improve this further you can put them in a scene and then you would only need to do this... If From Sunset To 10:30:00PM (same day) Then Set 'Outlet and Lantern Scene' On Else Set 'Outlet and Lantern Scene' Off
ergodic Posted October 21, 2010 Posted October 21, 2010 One problem is that I don't see any parentheses in your condition, which means... Well, I honestly don't know what it means since I don't remember the implied precedence of ISY conditions. But certainly not what you want it to mean. You can just put the program in a folder with the sunset-to-10:30pm condition on the folder and eliminate that test from the program itself. Or use parens to group the condition tests explicitly. The bigger issue is you are changing what you are triggering on. Those device changes cause the ISY to immediately stop the program and re-evaluate the program's conditions all over again. In ISY-land, programs like that almost never do what you want. There are different ways to handle an ISY program interfering with itself. My own suggestion is to break the program into two: a trigger program (P1) and another with the actual program statements (P2). You then add a condition to prevent P1 from re-triggering P2 while P2 is already running. (Program P1): If Program P2 is false and time is between sunset and 10:30 PM same day and (outlet is OFF or lantern is OFF) Then run program P2 (Then Part) (Program P2): If (no conditions) Then Turn outlet On Turn Lantern On Run Program P2 (else part) You can also add a startup statement to your ISY to 'run P2 (else part)' to explicitly initialize P2 false when the ISY boots. This isn't necessarily the simplest solution here; I prefer it simply because it works for all cases as a general ISY technique and it is easy to understand and change the programs. Another solution here would be to break the program into two parts, one program for the outlet and one for the lantern. That will work only because each program then becomes only one statement. So by the time it interferes with itself it is already done. But add just one more device or one more statement to the mix and you're right back to hair-pulling.
apostolakisl Posted October 21, 2010 Posted October 21, 2010 I am confused by why the program is causing the light to turn on and off repeatedly. I do understand why it would fail to complete. As I see it, when the first light in the program has it's status addressed by the then section of the program, the program will retrigger (terminating the execution of the then/else parts) and thus not complete the turning on of the second light. This would get caught in a loop until it is no longer between sunset and 10:30 or until somehow both lights became on. Where is the command that is turning the light off? What am I missing here that would make the lights go on/off/on/off as I believe was what the original question was?
aLf Posted October 23, 2010 Author Posted October 23, 2010 Tried the folders thing and it couldn't get it to work. Anybody who can help "design" this, please help out. Here is my hope... SW 1 & SW 2. Want them to come on between 11/1/10 and 1/31/11, at times 05:00AM to 7:00AM, then again between sunset and 10:35PM (sameday). (Christmas Lights). I've always liked the setup that will force the SW to go back on should someone turn it off (IF SW1 is OFF, turn it ON). I was hoping to have the entire days schedule in one program. But whatever the best way to skin the cat, I'm very appreciative. Thanks, aLf
ergodic Posted October 23, 2010 Posted October 23, 2010 Have you tried the simple, two single-statement program approach? if status sw1 is off then set control sw1 on if status sw2 is off then set control sw2 on I can't think of any reason this wouldn't work to do what you ask, but as with any ISY programming you have to try it. Forget about the time-of-date and date-range checks for now. That can be dealt with easily by adding program or folder conditions. But ignoring the time-of-day, does this do what you want?
Sub-Routine Posted October 23, 2010 Posted October 23, 2010 Hi aLf, Personally, I would create a number of programs. One (or two) to turn the lights on, another one or two to turn them off, one (or more) to watch the status. Create a scene with both switches and control the scene rather than individual devices. Try to keep each program as simple as possible. Put all the programs in a folder just to stay organized, but you could also add a date range to the folder. Rand
Recommended Posts