birdman Posted August 22, 2011 Posted August 22, 2011 I am trying to write a program which would rely on a time lapse as a condition. For example, I would like to receive an email notification if my daughter's closet light is left on for longer than 10 minutes (leading me to believe that she turned it on and then walked out of the room forgetting to turn it off). I have been playing around but have not yet figured out how I would program the condition. Any assistance / tips would be appreciated. TIA (thanx in advance)
LeeG Posted August 22, 2011 Posted August 22, 2011 birdman This program will accomplish what you are looking for. The ICON ON OFF would be the closet light switch and replace the Send X10 On with your email Notify. If Status 'ICON ON OFF' is On And Status 'ICON ON OFF' is not Off Then Wait 10 minutes Send X10 'A1/On (3)' Else - No Actions - (To add one, press 'Action') When the closet light is turned On the Program Then is invoked starting a 10 minute wait. If the closet switch is turned Off before the 10 minute Wait completes the Program Then clause is terminated and the Else clause is run. Lee
andyf0 Posted August 22, 2011 Posted August 22, 2011 If Status Daughter_Closet is On And Status Daughter_Closet is not Off Then Wait 5 mins Send EMail to me Else When the closet turns on it'll wait for 5 mins then send an EMail. If during the 5 minutes the closet turns off it will interrupt the program and just exit. Edit: Lee beat me to it.
birdman Posted August 22, 2011 Author Posted August 22, 2011 Thanx. I was missing the existence of the "Wait" command. Very helpful.
klundy Posted August 23, 2011 Posted August 23, 2011 If Status 'ICON ON OFF' is On And Status 'ICON ON OFF' is not Off What is the purpose of checking for both "On" and "not Off"? If the device is a relay and not a dimmer, doesn't "on" = "not off"? (I'm still new to the ISY programming, so I am just reading threads to learn) Thanks Kevin
LeeG Posted August 23, 2011 Posted August 23, 2011 klundy Force of habit, it is not needed for this example. The "not Off" is used to drive the Else clause when If Control is being used. I chose to use If Status rather than If Control to prevent repeated On paddle presses from suppressing the desired email notification. The second part of the If would be needed when using If Control. Lee
apostolakisl Posted August 23, 2011 Posted August 23, 2011 If Status 'ICON ON OFF' is On And Status 'ICON ON OFF' is not Off What is the purpose of checking for both "On" and "not Off"? If the device is a relay and not a dimmer, doesn't "on" = "not off"? (I'm still new to the ISY programming, so I am just reading threads to learn) Thanks Kevin You are correct. The single "status is not off" statement will suffice. I have dozens of programs that are written that way. Every time anyone touches the light switch, the program will evaluate, and if it is anything but "off" it will run the "then" clause. If someone touches the light switch during the execution of the "wait" clause, the program will terminate and start over from scratch. Also, if a command is sent to that switch (like from another switch), that will also terminate the program and start it over, even if it the command is "on" and the light is already "on". So if the light is on, and 5 minutes have passed in a 10 minute wait, then someone hits the up part of the paddle, the program wait will terminate, the program will re-eval from scratch, it will evaluate as "true" and the "then" clause will start all over again at 10 minutes.
birdman Posted August 23, 2011 Author Posted August 23, 2011 This has been very helpful. I have since modified the program to include both my daughter's closets (If Daughter A's closet is ON OR Daughter B's closet is ON, etc) and to provide that after 10 minutes, the lights are shut off (and I still get an email so I can remind them that they left it on!)
Recommended Posts