Jump to content
C4 Forums | Control4

Using Scheduler for Time-Conditional Programming


Recommended Posts

I have a Z2IO near where my Projector is mounted about 9 feet up, in a room with a 13' vaulted ceiling.  I also have 2 ceiling fans.  During hot days, the space in the vault holds a lot of hot air.  I want to program such that when the Z2IO temperature is above 78 degrees, the fans will turn on, and when the temperature is 78 or below, it will turn them off.  I programmed off the Z2IO Local_Temperature Variable as follows:

When Z2IO Local_Temperature Changes:

          If Z2IO Local_Temperature > 78
                  Turn Fan on Medium-High
          If Z2IO Local_Temperature </= 78
                   Turn Fan off

Programmed like this, it works perfectly.  But I would like this to function only between 7:00 AM and 10:00 PM, so using the Scheduler from the 'Device Actions' Panel on the right, using its Conditional Tab, dragged "If time is between 7:00 AM and 10:00 PM" to the Script Window, and then Nested the 2 Conditionals under it:

When Z2IO Local_Temperature Changes:

          If time is between 7:00 AM and 10:00 PM
                    If Z2IO Local_Temperature > 78
                              Turn Fan on Medium-High
                    If Z2IO Local_Temperature </= 78
                               Turn Fan off

But when I do this, the Temperature Change event no longer triggers any actions, and I don't see why.  When "If time is between 7:00 AM and 10:00 PM" is True, then I would have thought that the same code underneath it should execute, just as it did when that conditional wasn't there.  But that doesn't seem to be the case.  I thought about using "While" rather than "If" but wanted to understand what I'm missing to begin with.

I also want to add a Conditional so that when I have the Fans on High for when I exercise in there, the code won't execute, but wanted to get this straightened out first.

Thanks.

Link to comment
Share on other sites


In theory your code should work.  A few comments though:

1. I would have moved the “off” code out from under the “time between” if... otherwise, the fan could turn on and not turn off until the next day.

2. What OS are you on? I seem to recall one OS version in the last couple of years where the “time between” conditionals was not working properly.

3. Another way of doing this would be to have a variable (called, say, FanActiveTime) which you set to true when a schedule event runs at 7am and set it to false when a schedule event runs at 10pm.  You would then change your if statement to be “if FanActiveTime is true then”.

Link to comment
Share on other sites

Thanks for the reply.

1.  Interesting point that I hadn't considered.  But I do have a Scheduled Event at 11:30 every night where I included turning off both fans, along with lights, garage doors, locks, etc.  So that should take care of that potential problem.

2.  I'm on 3.1.3.

3.  I thought about this as well, and may do that if the "time between" conditional won't work for whatever reason.

Link to comment
Share on other sites

3 hours ago, Don Cohen said:

Thanks for the reply.

1.  Interesting point that I hadn't considered.  But I do have a Scheduled Event at 11:30 every night where I included turning off both fans, along with lights, garage doors, locks, etc.  So that should take care of that potential problem.

2.  I'm on 3.1.3.

3.  I thought about this as well, and may do that if the "time between" conditional won't work for whatever reason.

“Time between” should work on OS3.1.3.  I am pretty sure that I use it I’m some instances.  Will try and check tomorrow.

Link to comment
Share on other sites

4 minutes ago, South Africa C4 user said:

“Time between” should work on OS3.1.3.  I am pretty sure that I use it I’m some instances.  Will try and check tomorrow.

I went ahead and created a Variable, setting it to True or False at the appropriate times, then programmed in the Conditional, and it seems to be working correctly.  I added an AND to the Conditional (If Fan Speed doesn't equal 4) which should prevent it from slowing down or turning off when I have Exercise mode turned on (both fans at 4).

But I would still be interested in what you find, since the logic seems straight-forward.

Thanks for your help.

Link to comment
Share on other sites

  • 3 weeks later...
On 7/31/2020 at 1:25 AM, Don Cohen said:

I went ahead and created a Variable, setting it to True or False at the appropriate times, then programmed in the Conditional, and it seems to be working correctly.  I added an AND to the Conditional (If Fan Speed doesn't equal 4) which should prevent it from slowing down or turning off when I have Exercise mode turned on (both fans at 4).

But I would still be interested in what you find, since the logic seems straight-forward.

Thanks for your help.

Sorry... I forgot all about this until I used “between” again today. It definitely works in OS3.1.3 for me and it definitely stopped working in OS3.1.x for me..l just not sure if x is 0, 1 or 2...

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.