Jump to content
C4 Forums | Control4

Programming a Keypad Button to do certain actions based on time


snipboy

Recommended Posts

My wife wants a simple setup at her bedside table. I have a two button keypad in a enclosure waiting to be bound for her.

During the hours of 6:00 AM - 11 PM she wants one button to do a goodnight action, turn off all lights, lock all doors, close garage doors. The second button she would like to use to alert me in my office.

These are pretty easy things to program...however, after 11 PM at night, she would like one of the buttons to turn on the lights in the master bath to 40%, and the second button to drop the temperature 2 degrees.

I could do the whole press/release/double tap--but she has already failed to grasp that capability and I've ended up reprogramming 3-button switches around the house to accommodate her. (I've got the double taps doing things I want though...)

Any ideas here?

Link to comment
Share on other sites


Indeed - you'll find the ability to do time based IF statement right under scheduler (no need to create schedule events for this, just go to scheduler on the right hand side). It'll give you specific time (or not) before after or even between.

Link to comment
Share on other sites

I use a scheduled event to set a variable, that way I don't have to care about how the > and < time works.

ie: set a variable 'nighttime' = true at 11pm and set 'nighttime' = false at 6am

Then use this variable in the button click event

if nighttime = true then

if master bath is off then

set master bath = 40%

stop

set master bath = off

stop

execute scene goodnight

Link to comment
Share on other sites

Can anyone answer how the if statements work with time.

Given time is cyclical - where does it stop being > and become < ?

ie: 10pm is less than 11pm but is 10am less than 11pm?

Does it work based on 12 hours each side?

ie:

10:01am is less than 10pm ??

9:59 is greater then 10pm ??

Link to comment
Share on other sites

It counts from midnight to midnight, so 9am<11am<1pm<11pm.

it in fact runs an a 24hour cycle, just used am/pm notation (you set am/pm).

While you can uses a scheduled event to set a variable, the built-in functionality is all there read to use. Using variables does have the advantage that you can edit one schedule and change all the programming associated, then again that sword cuts both ways - you can't edit the one schedule event for just part of the programming.

Note that Night and Day Time under the schedule conditionals is a self contained adaptive time "zone" from sun down to sun up and back, automatically adjusted much like sunset and sundown in the schedule agent/

Link to comment
Share on other sites

Thanks CyKnight - yes the Night and Day options built in are brilliant for my lighting based on sensors.

Snipboy - I would recommend the use of these options in your programming - So useful to program based on sunrise and sunset for differing options.

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.