IndyMike Posted January 12, 2008 Posted January 12, 2008 The following is an example of how to prevent "inadvertent" lighting. With the advent of KPL's and remote activated lighting, we often can't "see" what is occurring when something is activated. Family members and friends often don't understand the lighting system. The result can be outside lights that a left on during daylight hours or indoor lighting left on during the wee hours of the night. With the advent of X10 2-way modules, we were able to monitor when loads were activated and time them or check them against predefined operating times. I had previously managed to monitor lighting during "off time" hours with my X10 system. It was extremely involved and required many macros. With the ISY program structure, it's like falling off a log. The following code monitors a "scene status lamp" for my first floor. 1)If any lamp on my first floor is activated the "master KPL 1st Fl" is turned on.2)If this occurs during the "off hours" a 11 minute off timer is started. This would presumably allow a family member to get a glass of milk during the activated time.3)After 10 minutes the lights are dimmed ~50% to warn anyone that they are near the end of the timer period.4)The "lockout" is a separate KPL button that can be activated at any point to exit the timer program. I use this in the event that my wife or I are having one of those "sleepless nights" and want to read a book. If ( On Sun, Mon, Tue, Wed, Thu From 11:00:00PM To 3:35:00AM (next day) And ( Control 'Bar Lamp KPL2-Primary' is switched On Or Control 'Bar Lamp' is switched On Or Control 'Bar Cans' is switched On Or Control 'Bar Cans KPL2-C' is switched On Or Control 'Fam Lamps KPL1-C' is switched On . . . ) And Status '1st Fl Timer Lockout 08.4C.8' is Off ) Or ( On Sat, Fri From 12:00:00PM To 5:00:00AM (next day) And ( Control 'Bar Lamp KPL2-Primary' is switched On Or Control 'Bar Lamp' is switched On Or Control 'Bar Cans' is switched On Or Control 'Bar Cans KPL2-C' is switched On Or Control 'Fam Lamps KPL1-C' is switched On . . . ) And Status '1st Fl Timer Lockout 08.4C.8' is Off ) Then Wait 10 minutes Repeat 15 times Set Scene '1st Floor Off' Dim Repeat 1 times Wait 1 minute Set Scene '1st Floor Off' Off Else - No Actions - (To add one, press 'Action') Corrected on 1/13/08 - Changed from status monitoring to "Control Event" monitoring. Status monitoring causes problems with the repeat loops and the second wait statement due to the re-entrant nature of the code. I have similar programs monitoring my outside entry lighting and X10 flood lamps. Ever come home after work to find that someone has accidentally activated your flood lamps (for who knows how long)? This would absolutely kill me is the past. Not a problem any more. If they are inadvertently activated, the ISY triggers and turns them off in a predetermined time frame. IM Quote
DBaldwin Posted January 12, 2008 Posted January 12, 2008 Thankyou very much for the code and the ideas. I'll implement them post haste. Quote
aLf Posted January 13, 2008 Posted January 13, 2008 I'm thinking the MBR KPL 1st ought to be "on" for this to work, shouldn't it? The "on" would make it "true" and "else" would run... aLf Quote
Mark Sanctuary Posted January 13, 2008 Posted January 13, 2008 I was wondering about your naming convention...why do you keep the device's address in the name? 'Master KPL 1st FL 08.47.97.G' Quote
Sub-Routine Posted January 13, 2008 Posted January 13, 2008 I'm thinking the MBR KPL 1st ought to be "on" for this to work, shouldn't it? The "on" would make it "true" and "else" would run... aLf The code uses '> Off'. Quote
IndyMike Posted January 13, 2008 Author Posted January 13, 2008 Forum Members, My apologies to anyone who tried to implement the original example posted above. It flat didn't work. I had tried to "pretty things up" with repeat loops and add an additional feature (the one minute delay prior to off). I had thought that I had tested these upgrades prior to posting. Obviously I made a mistake somewhere (most likely didn't "save" the code prior to testing). With the ISY program structure, it's like falling off a log. Looks like the log fell on me instead. The bottom line is the repeat loops and second delay don't play well with "status" monitoring. I've corrected the original post using "control event" triggering. This does appear to work (at least this morning) and provides similar features. Again, my apologies to anyone who's time may have been wasted trying to implement the original code. An example of a simple status monitor for my outside entry lamps follows. This has been working for a number of weeks, and I didn't try to pretty it up this time. The following monitors the outside lighting during daylight hours. If any lamp is inadvertently turned on it is shut down two minutes later. I used the 2 minute timer because I am at times experimenting with the lighting and need that time to check for results. IM If From Sunrise + 1 minute To Sunset - 10 minutes (same day) And ( Status 'Outside Deck ' > Off Or Status 'Outside Garage ' > Off Or Status 'Outside Patio ' > Off Or Status 'Outside Porch ' > Off ) Then Wait 2 minutes Set Scene 'Ouside Night' Off Else - No Actions - (To add one, press 'Action') Quote
Algorithm Posted January 14, 2008 Posted January 14, 2008 Great example, Indy. I really like your idea of dimming the light shortly before it is turned off, to warn of the impending off! In your conditions, you test twice for the devices being switched on (and for the lockout), because of different times during the week versus the weekend: If ( On Sun, Mon, Tue, Wed, Thu From 11:00:00PM To 3:35:00AM (next day) And ( Control 'Bar Lamp KPL2-Primary' is switched On Or Control 'Bar Lamp' is switched On Or Control 'Bar Cans' is switched On Or Control 'Bar Cans KPL2-C' is switched On Or Control 'Fam Lamps KPL1-C' is switched On . . . ) And Status '1st Fl Timer Lockout 08.4C.8' is Off ) Or ( On Sat, Fri From 12:00:00PM To 5:00:00AM (next day) And ( Control 'Bar Lamp KPL2-Primary' is switched On Or Control 'Bar Lamp' is switched On Or Control 'Bar Cans' is switched On Or Control 'Bar Cans KPL2-C' is switched On Or Control 'Fam Lamps KPL1-C' is switched On . . . ) And Status '1st Fl Timer Lockout 08.4C.8' is Off ) Could the device (and lockout) tests be done only a single time by combining the two time checks with an 'Or'? If ( On Sun, Mon, Tue, Wed, Thu From 11:00:00PM To 3:35:00AM (next day) Or On Sat, Fri From 12:00:00PM To 5:00:00AM (next day) ) And ( Control 'Bar Lamp KPL2-Primary' is switched On Or Control 'Bar Lamp' is switched On Or Control 'Bar Cans' is switched On Or Control 'Bar Cans KPL2-C' is switched On Or Control 'Fam Lamps KPL1-C' is switched On . . . ) And Status '1st Fl Timer Lockout 08.4C.8' is Off I haven't tested this, but if it works it would help shorten the code. Quote
Sub-Routine Posted January 14, 2008 Posted January 14, 2008 I think you would find it to be more efficient to use Folders to define the time frame for these programs. The you could move the whole On Sun, Mon, Tue, Wed, Thu From 11:00:00PM To 3:35:00AM (next day) Or ( On Sat, Fri From 12:00:00PM To 5:00:00AM (next day) from the Program to a Folder. Here are examples for my outdoor lights: When Dark Folder Conditions for 'When Dark' Add conditions to limit when programs in this folder are allowed to run. If From Sunset - 15 minutes To Sunrise + 27 minutes (next day) Then Allow the programs in this folder to run. When Light Folder Conditions for 'When Light' Add conditions to limit when programs in this folder are allowed to run. If From Sunrise + 28 minutes To Sunset - 15 minutes (same day) Then Allow the programs in this folder to run. Then add a sub-folder to the When Dark Folder is True for a specific KPL button to be On: Party Time Folder Conditions for 'Party Time' Add conditions to limit when programs in this folder are allowed to run. If Status 'Family Room KPL 2' is On Then Allow the programs in this folder to run. Then your Party Program would be this simple: If Control 'Bar Lamp KPL2-Primary' is switched On Or Control 'Bar Lamp' is switched On Or Control 'Bar Cans' is switched On Or Control 'Bar Cans KPL2-C' is switched On Or Control 'Fam Lamps KPL1-C' is switched On . . . Then Wait 10 minutes Repeat 15 times Set Scene '1st Floor' Salsa Repeat 1 times Wait 1 minute Set Scene '1st Floor' Off Else - No Actions - (To add one, press 'Action') and it would only run When Dark and Party Time are true and someone activates one of your included switches. Personally, I don't want my home to automate me so I never override switches On. Switches Off I will return to night lights. Rand Quote
IndyMike Posted January 14, 2008 Author Posted January 14, 2008 Just Another Joe and Rand, Thank you both. Excellent suggestions - I'll be test driving both when time permits (weekends). Rand - I agree completely with your stance on automation working for you rather than the opposite. Alas, I answer to a higher authority. The 11:00 PM activation time is a concession to my family's lifestyle. I'm the one that wakes up at 3:45 for work. I'm in bed long before the "kids" and they have a problem finding the "off" position on the switches. Thanks again guys, IM Quote
Sub-Routine Posted January 15, 2008 Posted January 15, 2008 Just Another Joe and Rand, Thank you both. Excellent suggestions - I'll be test driving both when time permits (weekends). Rand - I agree completely with your stance on automation working for you rather than the opposite. Alas, I answer to a higher authority. The 11:00 PM activation time is a concession to my family's lifestyle. I'm the one that wakes up at 3:45 for work. I'm in bed long before the "kids" and they have a problem finding the "off" position on the switches. Thanks again guys, IM I remember those days We used to stay up all night Quote
jeff-lines Posted February 7, 2008 Posted February 7, 2008 After 10 minutes the lights are dimmed ~50% to warn anyone that they are near the end of the timer period. I love this idea. I have a program that shuts off the garage lights at 10PM and Front Lights at 11:30PM and had them set up to flash off for a couple seconds as a warning before going completely off, but I like the idea of the dimmed. Another idea would be to do a repeat to dim the scene like using a ramp, but without the side affect of having it do the same thing when you turn the lights on. For the most part, I just want to turn the garage and exterior lights off; I just don't want to get caught in the dark because they automatically turned off at the designated time. Thanks for the great idea. Can't wait to try it tomorrow. 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.