mitch236 Posted February 9, 2010 Posted February 9, 2010 Here is a program I wrote. What I want to have happen is for my Carriage Lights turn on when either it is sunset OR the Climate module has light=0 and then turn off at 9pm daily. Here is my script: If: -( l Time is Sunset l Or Climate Module Light is 0 -) And From 4:00:00PM To 9:00:00PM (same day) Then: Set 'Garage (Carriage Lights) Lights' On Else: Set 'Garage (Carriage Lights) Lights' Off Does that look right? Also, is there an easier way to show what I've programmed other than re-typing it? Thanks! Quote
oberkc Posted February 9, 2010 Posted February 9, 2010 I am unfamiliar about light levels, but is it possible that they don't get ever to 0? If so, this program might not work for you. If light >0 and sunset, I expect this program to run the "then" statement, but immediately run the "else" statement when time is not sunset. One can copy programs and paste to the forum. I am having to go by memory, but I am thinking right click on a given program, and choose copy. Quote
Sub-Routine Posted February 9, 2010 Posted February 9, 2010 Hello Mitch236, I suggest using separate programs. First, Sunset: If Time is Sunset Then Set Scene 'Outside Lights' On Else - No Actions - (To add one, press 'Action') For the Light data see this Wiki example: ISY-99i_Series_INSTEON:Light_Data_Program Rand Quote
mitch236 Posted February 9, 2010 Author Posted February 9, 2010 Hello Mitch236, I suggest using separate programs. First, Sunset: If Time is Sunset Then Set Scene 'Outside Lights' On Else - No Actions - (To add one, press 'Action') For the Light data see this Wiki example: ISY-99i_Series_INSTEON:Light_Data_Program Rand I read the wiki but that program is much more complicated than what I need. I just want the light to come on either at sunset OR if the sky gets dark. If I run two seperate programs to turn the light on, I would need to be sure to prevent any loops from forming and that can get tedious when dealing with more than 30 units (as mine will be when complete). I would rather keep the programming as simple as possible. What is the advantage to running a seperate Light Data program? Quote
oberkc Posted February 9, 2010 Posted February 9, 2010 I also look forward to understanding the benefit to two programs, one for light, and one for sunset. My inclination is to run two programs, on and off. On would be based on light or sunset. It would have no "else" conditions: if light = 0 or time = sunset then set scene 'outside lights' on else if time = 900p then set scene 'outside light' off else I suspect part of your problems ealier was with the program re-evaluating itself every time the conditions change, then running the else statements. Another potential problem with your first attempt would be that the program may prevent you from manually turning the lights off before 900 if you choose. That would bother me. Of course, there are many ways of doing what you want. You could use folders, you could nest programs within programs. You could use multiple programs. Experiment around and have fun. Quote
mitch236 Posted February 9, 2010 Author Posted February 9, 2010 Sorry if I'm asking really stupid questions but wouldn't manually changing the status of a device (by turning the light switch off for example) override the program? Quote
oberkc Posted February 9, 2010 Posted February 9, 2010 Depends on the program. If you have a program something like: if from 5p -10p then set light on else Such a program would ensure the lights stay on during that period. If you turn them off, the program would execute the else statement, because the condition (between 5 and 10 pm) is still true. A program such as if time = 5p then set light on else This is a one-time good deal, where the condition is only true for a moment on any given day. At 501, the condition is no longer true. If you turn the light off, the program will not re-execute anything. Quote
markens Posted February 9, 2010 Posted February 9, 2010 Depends on the program. If you have a program something like: if from 5p -10p then set light on else Such a program would ensure the lights stay on during that period. If you turn them off, the program would execute the else statement, because the condition (between 5 and 10 pm) is still true. Careful, you might want to check this. I'm pretty sure that a "From-To" time condition by itself causes the IF to be evaluated exactly twice: Once at the start time (result TRUE) and once at the end time (result FALSE). If there are also other conditions in the IF that cause the conditions to be evaluated (such as a switch control or status), then the logic value of the From-To time condition is indeed taken into account at that time as well (TRUE during the period, otherwise FALSE), which allows conditional handling of those events. To illustrate, the following (perhaps not very useful) example program will always turn the light back on if it is turned off during the time period. This also illustrates how switch status can "override" a program: if from 5p -10p and status 'light' is off then set light on else The IF is evaluated whenever the status of the light changes, plus at 5pm and 10pm. The result is TRUE (execute THEN) if the light status is OFF between 5pm and 10pm, otherwise FALSE (execute ELSE, if any). Note another side effect of this program: When the light is turned on via the THEN, the status change from OFF to ON triggers another evaluation if the conditions. The time is presumably still within the specified period (TRUE), but the status condition is now FALSE due to the switch status. So the program will continue to execute the ELSE if anything is there. This behavior is often not anticipated, and is a common source of problems in programs. Quote
oberkc Posted February 9, 2010 Posted February 9, 2010 Careful, you might want to check this I checked and stand corrected. My memory is worn out. I created this program: If From 4:45:00PM To 7:45:00PM (same day) And Control 'SW LRW Livingroom Wall' is switched Off Then Set 'PM LRT Livingroom Table' On Else - No Actions - (To add one, press 'Action') this one kept turning the lights back on, after I switch them off. Changing the condition from 'control' to 'status' produced the same results. Quote
MarkJames Posted February 9, 2010 Posted February 9, 2010 Depends on the program. If you have a program something like: if from 5p -10p then set light on else Such a program would ensure the lights stay on during that period. If you turn them off, the program would execute the else statement, because the condition (between 5 and 10 pm) is still true. Are you sure about that oberkc? I would have thought that the status of the light itself would have to be in the condition being evaluated for that to happen. I still get confused by the then/else functionality of ISY Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.