FredK Posted October 26, 2018 Posted October 26, 2018 Hello guys (and gals I assume), I am using Composer HE to program my C4 system. I have a DSC alarm system integrated with a lot of motion detectors that I installed specifically to trigger events with my C4 system. One of the BIG things I wanted to do was use existing room lighting as night lights, for example. WHAT I WANT TO DO: When you walk into the kitchen (at night) for example, I want the under cabinet lights to come on for 3 minutes and reset that timer on each motion detect (there is a motion detector in the kitchen). This works fine. However, when I want the under cabinet lights on in the kitchen (when cooking for example), they keep turning off. I understand why, the kitchen motion detects motion and starts the auto off timer, etc, etc, etc.. I want to disable the auto off timer when the user presses the light switch for the under cabinet lights. So I programmed the switch to disable the auto off timer when pressed. But when the motion is detected again, it turns on the auto off timer again and the lights keep turning off. So, all I want to do is have the lights function "normally" when the user presses the switch, that is STAY ON. When the lights are turned off, either with the switch or thru some automated function it can return to motion detect functionality. Like I said - its probably simple, but outside of the scope of my knowledge. Does anyone have any suggestions? Thanks in advance - Fred
South Africa C4 user Posted October 26, 2018 Posted October 26, 2018 Hi Fred, There are a number of different ways to do this. One way is when motion is detected check whether the lights are on. If they are, don’t start the timer. Otherwise start the timer. While this is the simplest, it means that lights will be on for 3 minutes after motion is first detected and then turn off. They will then turn on again if motion is detected again. You probably actually want the lights to stay on for 3 minutes after motion is last detected? If so, one way to do this is to create a variable (called, say, AutoLightsOn). When you use the switch to turn lights on, set AutoLightsOn to False. When you detect motion, check if lights are on. If they are on and AutoLightsOn is False then do nothing. Otherwise (if AutoLightsOn is true or the lights were off), set AutoLightsOn to True and start the timer. Hope that helps! You can make this a lot more complex too if you want. There are also a couple of drivers that may help although I (personally) have preferred the versatility of going the programing route.
FredK Posted October 26, 2018 Author Posted October 26, 2018 Hey SAC4user, Thanks for the reply. I think I get what you're saying. Here is what I did but not yielding the expected results. (see attached). Kitchen under cabinet lights will not turn on with kitchen motion :(
South Africa C4 user Posted October 26, 2018 Posted October 26, 2018 Hi Fred, I haven’t checked your code completely... but 2 comments that I think will solve your problem (or at least move you in the right direction. 1. You need to indent a stop in under the second if... so it does not move on to the following lines of code. I.e. if lights is on, if AutoLightsOn is true then STOP. 2. You should then delete the line “if AutoLightsOn on is true”. You will first need to move the code that is indented under this line out. Hopefully that makes sense!
FredK Posted October 26, 2018 Author Posted October 26, 2018 Nope....totally lost. But I won't take up any more of your time. Tried what you said though and still not working. I really need to get my head around what is actually happening. this will help me more than anything. Have a great day!
South Africa C4 user Posted October 26, 2018 Posted October 26, 2018 Good luck! Maybe the following will help... Your first two if’s do nothing... what you need is this when motion is detected: if kitchen->under cabinet is on If AutoLightsOn is false Stop Variables AutoLightsOn = True Turn On kitchen->under cabinet Restart auto off timer on kitchen under cabinet
Cyknight Posted October 26, 2018 Posted October 26, 2018 Hmm. I would suggest WHEN top button is pushed set variable to false WHEN light is turned off set variable to true WHEN timer expires IF timer is true Turn off lights WHEN motion is detected IF lights are off Turn on lights reset timer This should catch most if not all user occasions
Recommended Posts
Archived
This topic is now archived and is closed to further replies.