dan55 Posted September 11, 2014 Posted September 11, 2014 Hi, I need a help with programming and logic. Running 4.2.10(RC4) I have some people in my household that refuse to turn out lights. I want to have a countdown timer to turn out the lights in certain rooms like the bathroom after a set period of time. In some cases a motion sensor works great, however in the bathroom the motions do not work well and things like shower curtains and heat from the shower block the sensors. The logic is this: if a the SwitchLink is not turned off then stay on for a period of time, after the period of time then dim the light to 40% as a notice that is to going to go off, and then turn the light off in thirty seconds. This program works great except that if *gasp* someone actually turns off the light then after the initial timer completes, then the code turns the light back on at 40% for 30 seconds, which I'd rather not do. If Control 'Upstairs Bathroom Light' is switched On Or Control 'Upstairs Bathroom Light' is switched Fast On Or Control 'Upstairs Bathroom Light' is switched Fade Up Or Control 'Upstairs Bathroom Light' is switched Fade Down Or Control 'Upstairs Bathroom Light' is switched Bright Or Control 'Upstairs Bathroom Light' is switched Dim Then Wait 20 minutes and 10 seconds Set 'Upstairs Bathroom Light' 40% Wait 30 seconds Set 'Upstairs Bathroom Light' Fast Off Else - No Actions - (To add one, press 'Action') Using Control 'Upstairs Bathroom Light' is not off failed. I suppose I could call a second program to reevaluate if the light is still on in the then clause, however, there seems like there should be a cleaner way and I'm already upwards of 40 programs and I'd like to keep things simpler. Another method I tried was with status (different switch in the house) If Status 'Master Bathroom Light' is not Off Then Wait 10 seconds Set 'Master Bathroom Light' 40% Wait 15 seconds Set 'Master Bathroom Light' Fast Off Else - No Actions - (To add one, press 'Action') I have the timers set much lower for testing. As I would expect on a status program, this program waits the 10 seconds then sets the switch then reruns the 10 seconds then runs the 15 seconds as the status changed. This is a problem because I would like that time to be 20 minutes. I don't think status is the way to go for this one. Any suggestions beyond a second program for the program with 'control' and any reason why control logic 'is not off' fails to activate the program? Thanks, Dan
LeeG Posted September 11, 2014 Posted September 11, 2014 (edited) The "is not switched Off" will drive the Else clause when device turned Off canceling the Wait in the Then clause. If Control 'Upstairs Bathroom Light' is switched On Or Control 'Upstairs Bathroom Light' is switched Fast On Or Control 'Upstairs Bathroom Light' is switched Fade Up Or Control 'Upstairs Bathroom Light' is switched Fade Down Or Control 'Upstairs Bathroom Light' is switched Bright Or Control 'Upstairs Bathroom Light' is switched Dim Or Control 'Upstairs Bathroom Light' is not switched OffThen Edited September 11, 2014 by LeeG
EricK Posted September 11, 2014 Posted September 11, 2014 Shouldn't this work: If ( Control 'Upstairs Bathroom Light' is switched On Or Control 'Upstairs Bathroom Light' is switched Fast On Or Control 'Upstairs Bathroom Light' is switched Fade Up Or Control 'Upstairs Bathroom Light' is switched Fade Down Or Control 'Upstairs Bathroom Light' is switched Bright Or Control 'Upstairs Bathroom Light' is switched Dim) and Status 'Master Bathroom Light' is not Off So if the light is not off (on) the then runs. If the light is off the program is false and the else runs.
dan55 Posted September 11, 2014 Author Posted September 11, 2014 Thanks for the suggestions. Neither worked because of my dimming (status change) before turning the lights off completely. Here are the two programs that work for 20 minute on / then dim to 40% for 30 seconds. If the light is turned off it doesn't come back on now. If Control 'Upstairs Bathroom Light' is switched On Or Control 'Upstairs Bathroom Light' is switched Fast On Or Control 'Upstairs Bathroom Light' is switched Fade Up Or Control 'Upstairs Bathroom Light' is switched Fade Down Or Control 'Upstairs Bathroom Light' is switched Fade Stop Or Control 'Upstairs Bathroom Light' is switched Bright Or Control 'Upstairs Bathroom Light' is switched Dim Then Disable Program 'Dim to Off - Upstairs Bathroom' Wait 20 minutes Enable Program 'Dim to Off - Upstairs Bathroom' Run Program 'Dim to Off - Upstairs Bathroom' (If) Else - No Actions - (To add one, press 'Action') Program Dim to Off - Upstairs Bathroom If Status 'Upstairs Bathroom Light' is not Off Then Set 'Upstairs Bathroom Light' 40% Wait 30 seconds Set 'Upstairs Bathroom Light' Off Else - No Actions - (To add one, press 'Action')
Techman Posted September 11, 2014 Posted September 11, 2014 In your program "dim to off" you need to delete the "If" line in that program. The "then" in your first program should read Wait 20 minutes Run then program dim to off
Recommended Posts