whywork Posted August 19, 2013 Posted August 19, 2013 Hi, I'd like some more programming lessons/advice, please. I want to (when it is dark outside) to turn on my kitchen light to 25% when motion is detected in my kitchen and then turn the light off, after a few minutes (for when I get up to sneak some desert from the refrigerator late at night). However, if the kitchen light is already on (at any brightness) I don' t want the motion detection, to change the light (leave it alone, don't brighten or dim, or turn off). I have an ISY994i with a 2474DWH dimmer and a 2842-222 motion detector. Here are the programs I have created: Kitchen Motion Detection If From Sunset To Sunrise (next day) And Control '3 Motion-Sensor Kit' is switched On And Control 'Kitchen Island Light' is not switched On Then Run Program 'KitchenIslandTimer' (Then Path) Else - No Actions - (To add one, press 'Action') KitchenIslandTimer If Status 'Kitchen Island Light' < 1% Then Set 'Kitchen Island Light' 25% Wait 2 minutes Set 'Kitchen Island Light' Off Else - No Actions - (To add one, press 'Action') This works great to: 1) Turn on Light to 25% when I walk in the kitchen 2) Turn off Light two minutes after I leave. However – there is a problem; since I usually walk into the kitchen to turn on the light 1) The motion detector turns on the light, first/before I can touch the dimmer switch 2) And I then physically turn on the light to a different brightness 3) After two minutes, the light gets turned off I see why this happens because of my poor programming, but how can I get what I want, to avoid the shutoff after two minutes? Any thoughts appreciated.
oberkc Posted August 19, 2013 Posted August 19, 2013 You might try a slight modification: If From Sunset To Sunrise (next day) And Control '3 Motion-Sensor Kit' is switched On And Control 'Kitchen Island Light' is not switched On Then Run Program 'KitchenIslandTimer' (If Path)<<<< note IF path Else Run Program 'KitchenIslandTimer' (Else Path)<<<<< Note line added KitchenIslandTimer <<< If Status 'Kitchen Island Light' < 1% Then Set 'Kitchen Island Light' 25% Wait 2 minutes Set 'Kitchen Island Light' Off Else - No Actions - (To add one, press 'Action') Depending on your sense of probability that you may activate the light within two mintes of sunrise, you may need to create a third (and mostly redundant) program to simply turn off the light at sunrise.
Xathros Posted August 19, 2013 Posted August 19, 2013 I think this line in the first program: And Control 'Kitchen Island Light' is not switched On needs to read: And Status Kitchen Island Light is Off For 2 reasons. 1) On at any brightness is NOT Off. 2) A control event only happens at the exact moment the paddle it operated on a device whereas Status is going to reflect the current status of a device whenever you check it. -Xathros
oberkc Posted August 19, 2013 Posted August 19, 2013 I think this line in the first program: And Control 'Kitchen Island Light' is not switched On needs to read: And Status Kitchen Island Light is Off For 2 reasons. 1) On at any brightness is NOT Off. 2) A control event only happens at the exact moment the paddle it operated on a device whereas Status is going to reflect the current status of a device whenever you check it. -Xathros Xathros, Using status in this case would, I believe, cause this program to re-trigger when the timer program activates. I don't believe this is desirable in this case. I thought control might be better for the very reason you suggest...I want it to evaluate only because of direct action on the switch. One thing I am not clear about is whether there is a difference between an ON command and a BRIGHTEN command. If so, this single statement may need to be expanded to be something like: if ... and ( control is turned on or control is bright )
Xathros Posted August 19, 2013 Posted August 19, 2013 No, I think its OK. The motion control On event has already happened and the light is already on so it will evaluate false and run else. I actually see no use in the Else section of program 1 anyway. Your original requirement stated: "Unless the light is already on at any level." That says Status not Control to me. Control only happens at the instant that you touch the paddle. So if the motion detector sees you enter the room and the light is already on, Status would tell you that while control will not because you are not turning on the light manually at that instant. As you suspected, On, Off, Fade Up, Fade Down, Fade Stop, Fast On, Fast Off are all different control events. I do something very similar to this at my place though I use variables to manage the situation. What I do is this: If Control Kitchen Light is Switched On Or Control Kitchen Light is Switched Fade Up Or Control Kitchen Light is switched Fast On Then $i.KitchenMotionDisable=1 Stop Program KitchenTimer If Control Kitchen Light is Switched Off Or Control Kitchen Light is switched Fast Off Then $i.KitchenMotionDisable=0 If From Sunset to Sunrise (next day) And Control KitDinMotion is Switched On And $i.KitchenMotionDisable=0 Then Run KitchenTimer (Then Path) Program: Kitchen Timer If Then Set Kitchen Light 35% wait 4 minutes Set Kitchen Light Off This works will for me. The only thing that breaks this is when someone uses fade down to turn the kitchen lights off. Thankfully that rarely happens. -Xathros
oberkc Posted August 19, 2013 Posted August 19, 2013 No, I think its OK. When the light turns off the Else sections will run doing nothing. Perhaps I may be causing more confusion than helping. My response to the original poster ADDED a statement to the ELSE section. Thus, having the else section run would be detrimental, if attempting my proposed solution. I saw two problems with the OP original programs. First the timer program would trigger itself when called by the first program. I was concerned that this would halt the timer program immediately after initiation. Second, calling the timer program THEN path bypassed checking the ON condition in the IF path, so this would fire any time motion is sensed, regardless of current light status.
Xathros Posted August 19, 2013 Posted August 19, 2013 oberkc- You caught me mid edit. I see your points and agree with your diagnosis. However, I still believe that the Control statement in the OP's program was used in error as well. I have edited my previous post to include the method that I'm using as another possible solution. In this case, I think I added to the confusion. Sorry to both you and the OP. -Xathros
Recommended Posts