jgcharlotte Posted March 20, 2016 Posted March 20, 2016 NiteLite - [iD 003B][Parent 0007] If Status 'MBR-Corner Lamp' is Off And Control 'ZW 002 MBR Motion Sensor' is switched On Then Set 'MBR-Corner Lamp' 15% Wait 20 seconds Set 'MBR-Corner Lamp' Off Else - No Actions - (To add one, press 'Action') The OFF command never gets sent. so is the entire program disabled as soon as the light turns on, IE, the WAIT > OFF does not execute? It seems like the remainder of the program should execute regardless of the IF,
paulbates Posted March 20, 2016 Posted March 20, 2016 (edited) ISY programs stop executing when the if clause is no longer true. As soon as the light gets turned on to 15%, the program exits. You can make a separate program (2) with no If clause and put the Then statements in it. Replace the statements in your existing program (1) with a Program Run Then statement to run program (2). That program will run until complete NiteLite 1 If Status 'MBR-Corner Lamp' is Off And Control 'ZW 002 MBR Motion Sensor' is switched On Then Run Program 'NightLite 2' Then clause Else - No Actions - (To add one, press 'Action') NiteLite 2 If Then Set 'MBR-Corner Lamp' 15% Wait 20 seconds Set 'MBR-Corner Lamp' Off Else - No Actions - (To add one, press 'Action') Paul Edited March 20, 2016 by paulbates
jerlands Posted March 20, 2016 Posted March 20, 2016 Or you could try this... If Status 'MBR-Corner Lamp' is Off And Control 'ZW 002 MBR Motion Sensor' is switched On Then Set 'MBR-Corner Lamp' 15% Else Wait 20 seconds Set 'MBR-Corner Lamp' Off You can observe the actions of the program by right clicking on it > Status Icons > Detailed then activate and observe Jon...
jgcharlotte Posted March 20, 2016 Author Posted March 20, 2016 Thanks! I guess that makes sense, just seems a bit illogical to me. But I'm sure there are cases when it would be a real advantage. Thanks for the help and suggestions!
larryllix Posted March 20, 2016 Posted March 20, 2016 Was there a particular reason to check if the lamp was off before dimming it? You could just take the line out.
jgcharlotte Posted March 20, 2016 Author Posted March 20, 2016 Sure, it's meant as a night light. If you get out of bed in the middle of the night, just put a little bit of light in the room. If it didn't check OFF status, every time motion is detected it would go to 15%. I did add a program that would turn it off prior to the auto turn-off time (which I set to 60 secs) if motion is detected, IE, going back to bed.
stusviews Posted March 20, 2016 Posted March 20, 2016 (edited) Thanks! I guess that makes sense, just seems a bit illogical to me. That's true, but programs do what you tell then do which is not always what you meant to say. Consider the condition you wrote: Status 'MBR-Corner Lamp' is Off which triggers Set 'MBR-Corner Lamp' 15%. At that instant, the condition evaluates as false and the program stops (or executes the Else statements). Paul's programs (#2) work because NiteLite 2 doesn't have a condition that keeps it from running to its conclusion. Edited March 20, 2016 by stusviews
jerlands Posted March 20, 2016 Posted March 20, 2016 Sure, it's meant as a night light. If you get out of bed in the middle of the night, just put a little bit of light in the room. If it didn't check OFF status, every time motion is detected it would go to 15%. I did add a program that would turn it off prior to the auto turn-off time (which I set to 60 secs) if motion is detected, IE, going back to bed. You'll learn it hand to create conditions such as Home | Away | Sleep | etc.. using State Variables and applying these to programs. These variables can be changed using a number of different methods like a remote for sleep or your phone's WiFi (location) for Home/Away. If Status 'MBR-Corner Lamp' is Off And Control 'ZW 002 MBR Motion Sensor' is switched On And $s.Sleep is 1 Jon...
apostolakisl Posted March 20, 2016 Posted March 20, 2016 Or you could try this... If Status 'MBR-Corner Lamp' is Off And Control 'ZW 002 MBR Motion Sensor' is switched On Then Set 'MBR-Corner Lamp' 15% Else Wait 20 seconds Set 'MBR-Corner Lamp' Off You can observe the actions of the program by right clicking on it > Status Icons > Detailed then activate and observe Jon... This would work great provided you don't want the light to ever be on aside from when the motion sensor triggers it. Turning the light on manually will trigger the program (a "status" line in a program triggers every time the status of said device changes), it will evaluate to false (since the control on motion sensor line will be false), the else clause will run, and 20 seconds later the light turns off.
jgcharlotte Posted March 20, 2016 Author Posted March 20, 2016 ISY programs stop executing when the if clause is no longer true. As soon as the light gets turned on to 15%, the program exits. You can make a separate program (2) with no If clause and put the Then statements in it. Replace the statements in your existing program (1) with a Program Run Then statement to run program (2). That program will run until complete NiteLite 1 If Status 'MBR-Corner Lamp' is Off And Control 'ZW 002 MBR Motion Sensor' is switched On Then Run Program 'NightLite 2' Then clause Else - No Actions - (To add one, press 'Action') NiteLite 2 If Then Set 'MBR-Corner Lamp' 15% Wait 20 seconds Set 'MBR-Corner Lamp' Off Else - No Actions - (To add one, press 'Action') Paul Paul's solution worked perfectly, transferring control to the second program. I just added another one that turns off the light if motion is detected again before the timeout (changed to 90 seconds) and I put the whole set in a folder controlled by a motion sensor dusk/dawn so it doesn't operate during the day. Thanks!
stusviews Posted March 20, 2016 Posted March 20, 2016 Keeping programs in folders makes it easy to find the program for editing. Also, you can include sunset to sunrise as a program condition.
Recommended Posts