Jump to content
C4 Forums | Control4

This is my other programing dilemma.


Recommended Posts

This is my other programing dilemma.

I have a card access motion sensor that turns on a C4 dimmer switch (ldz-102) when it senses motion, and when no motion is detected it turns the lights off after 5 minutes... Nothing really special.

I was trying to setup a program were I can double tap the top button on the C4 dimmer switch, and that would stop the timer and hold it there... So I can keep the lights on until I manually turned it off from the dimmer switch it's self.

Also the way it's setup now the motion sensor turns the lights on before you can even get to the dimmer switch.

Every time I think I got it, the lights go off after the 5 min timers runs down.

Any ideals would be great.

Thanks,

David

Link to comment
Share on other sites


Also, you don't ned to use a timer here. Just set the occupancy period on the motion detector to 5 minutes...that will also improve the battery life of the motion detector. You don't need to do this, what you've done will work great, but it would simplify things.

Link to comment
Share on other sites

I think you need to create a variable like "Hold Front Room Lights", then set that to TRUE when the button is double-tapped. Then you need to check that variable first in each of your existing three scripts -- only execute them if the variable is FALSE. Add to each of those scripts an "If variable is FALSE" statement and indent the rest under it.

This way, even if the timer is running when you double-tap, the script to turn off the lights when the timer expires will never execute even though the timer expired.

You may want to change an LED color when that variable is set so you know it's on manual control.

Then you need a way to set the variable back to FALSE. I think you could do that when the bottom button of the dimmer is tapped. Perhaps better would be to do it when the light level is changed and the level is zero, i.e. turned off by any means.

And if you set the LED color, be sure to set it back when the variable is set to FALSE.

Edit: Early bird Dan beat me again.

Link to comment
Share on other sites

I think you need to create a variable like "Hold Front Room Lights", then set that to TRUE when the button is double-tapped. Then you need to check that variable first in each of your existing three scripts -- only execute them if the variable is FALSE. Add to each of those scripts an "If variable is FALSE" statement and indent the rest under it.

This way, even if the timer is running when you double-tap, the script to turn off the lights when the timer expires will never execute even though the timer expired.

You may want to change an LED color when that variable is set so you know it's on manual control.

Then you need a way to set the variable back to FALSE. I think you could do that when the bottom button of the dimmer is tapped. Perhaps better would be to do it when the light level is changed and the level is zero, i.e. turned off by any means.

And if you set the LED color, be sure to set it back when the variable is set to FALSE.

Edit: Early bird Dan beat me again.

You were much more detailed in your explanation though...nice job.

Link to comment
Share on other sites

David,

On a side topic, it looks like all your devices are in the same "room" in the project even though they are in different physical rooms. Is that correct? And is it really how you want it?

I can see how that simplifies navigation sometimes, but beyond a small project it would seem to get unwieldy to navigate. No?

Link to comment
Share on other sites

David,

On a side topic, it looks like all your devices are in the same "room" in the project even though they are in different physical rooms. Is that correct? And is it really how you want it?

I can see how that simplifies navigation sometimes, but beyond a small project it would seem to get unwieldy to navigate. No?

Yea, that's the way my first installer set everything up. At the time I had HC300 and two dimmer switches in the theater room, and one dimmer switch for the front porch plus one wireless dimmer front room.

Added few more dimmer down the road and he just kept adding them at the Theater Room location, at the time it didn't really bother me ( nor did I know any better).

I always wanted to move everything to their own room, but was afraid once things got moved around that all my lighting scenes would stop working. I have a lot.

If I have all the lights that are now listed something like: Theater Room-Front Porch Light. To First Floor-Front Porch Light, or Theater Room-2nd Floor Hall Light, to Second Floor-Hall Light.

I take it that I would have to redo every lighting scene all over again, or can a room be created and then that light or keypad be dragged and dropped. So the lighting scene is still in tacked but. Just the location title is renamed?

Thanks,

David

Link to comment
Share on other sites

If you are using the variable as we suggested to signify manual control, then somewhere you've got to reset that variable to allow the automatic control to work again.

There's no single "right" way to do it. Below is one simple way. You could also check On/Off state instead of level. I'm not sure if "level=0%" is technically the same as "Off" in the Control4 scripting; I assume so, but don't know for sure. You could also do it with a tap of the bottom button (which turns the lights off anyway), but that doesn't do it if you turn the lights off from anything else (like a scene).

When your_room-->your_lights level changes

If the your_room-->your_lights level is = 0%

--> Variables-->your_hold_lights_variable = FALSE

--> Put code here to restore the LED color if you changed it elsewhere

Substitute your actual room, lights and variable names where appropriate. This assumes you set the variable = TRUE with some other script like the double-tap of the top button.

Controlling the LED color on my 1.8.0 system for a keypad is confusing but it's especially confusing for a dimmer. I still don't fully understand when the "On" and "Off" colors are used. And for a dimmer there's no "current" color on my system. I'm not at that house so I can't test it until later in April.

So for LED color you'll have to experiment. You also have to know the default color so you can restore it to default above. You probably need its RGB values; it's a version of blue but may not be one of the standard colors in the dialog.

Edit: typo in the sample script

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.