Jump to content
C4 Forums | Control4

Time conditionals?


LollerAgent

Recommended Posts


16 minutes ago, LollerAgent said:

Is there a way to use time as a conditional with programing?

Example:

I have a "Hello" button on a keypad.  If this button gets pressed between 9am-4pm, I want to enable "Housekeeper" mode.  Otherwise, I just want to execute my normal "Hello" macro.  Is there anyway to do this?

i do that with variables and the scheduler agent.  Every day at 9am I would have a variable called XYZ become true, and at 4pm that variable is False. 

Then with your button you program

IF variable XYZ is true...

IF variable XYZ is false...

Link to comment
Share on other sites

6 minutes ago, eggzlot said:

i do that with variables and the scheduler agent.  Every day at 9am I would have a variable called XYZ become true, and at 4pm that variable is False. 

Then with your button you program

IF variable XYZ is true...

IF variable XYZ is false...

Makes sense, thanks!

Link to comment
Share on other sites

7 minutes ago, LollerAgent said:

Makes sense, thanks!

yep no problem

i have 1-2 keypad buttons in my house using the same concept (just different times) but yeah just use the scheduler to change a variable state and then program off that variable state.  99% of the programming I have done in C4 (not my dealer) is based on T/F variable logic.  I keep it simple :-)  Mostly because I do not understand the other types of variables!

Link to comment
Share on other sites

Would this be the best way to change the brightness of a lighting scene depending on time of day ?  In other words, execute a dim bathroom light scene in the middle of the night vs the rest of the day ?  Set up 2 different ALS scenes, and trigger one or the other based on time of day.

Link to comment
Share on other sites

Would this be the best way to change the brightness of a lighting scene depending on time of day ?  In other words, execute a dim bathroom light scene in the middle of the night vs the rest of the day ?  Set up 2 different ALS scenes, and trigger one or the other based on time of day.
Yes
Link to comment
Share on other sites

I think you could do this easier and without the need for a variable. If your in the programming tab and scroll down the device actions pane on the right hand side, find the scheduler at the bottom and you can add a conditional for time at the top of script,  that would save you a whole bunch of other programming, setting of variables etc 

Link to comment
Share on other sites

7 hours ago, Thepritch88 said:

I think you could do this easier and without the need for a variable. If your in the programming tab and scroll down the device actions pane on the right hand side, find the scheduler at the bottom and you can add a conditional for time at the top of script,  that would save you a whole bunch of other programming, setting of variables etc 

Yeah, the only benefit to a variable is it makes it a lot easier to adjust the times or triggers (something other than time) that cause the behavior to change. 

Link to comment
Share on other sites

That is a good point, I hadn’t thought of that. On the topic of changing/editing programming though, the new way of replacing a line of code with another by holding shift makes this so much easier, it’s saved me so much time since they introduced that feature, I also love that you can select the whole script for copying and pasting now instead of just one line 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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