Jump to content
C4 Forums | Control4

Best practices for integrating HVAC with contact sensors


markf

Recommended Posts

My goal is to make it so that if a window or door is opened for longer than 5 minutes that the HVAC goes to off and then when everything is closed the HVAC goes back to auto.

Here's what I did:

When the window opens set the "window open" variable to true.

When the "window open" variable changes if it is true then start the "window open" timer, otherwise set HVAC to auto

When the "window open" timer expires, if window 1 is open, or if window 2 is open or if window 3 is open etc. set HVAC to off, otherwise stop the "window open" timer

This seems to work most of the time but there are some situations where it doesn't.  For what it's worth, this seems to work well downstairs where the HVAC is a Nest but upstairs where I have an Ecobee it seems little inconsistent.

Has anyone else come up with a better way to implement something like this? Do you see any obvious issues with what I've done?

Thanks for the help.

Link to comment
Share on other sites


I do the same thing.  I won't claim that my code should be the "best-practice" example, but here is how I do it.

  1. For each HVAC zone, I have a variable that counts the number of open windows/doors.  
  2. Every time a contact in the relevant zone opens, the zone open windows/doors variable gets incremented by one. Whenever a contact closes, it gets decremented by one.  (I have a safeguard in the code that prevents it from dropping below zero, just in case C4 misses an opening.)
  3. When the variable changes values to something greater than zero, it restarts a 5-minute timer -- if the timer is not already running.  
  4. When the variable changes values to zero, the timer stops and the Ecobee is set to auto mode.  
  5. If the timer expires, it sets the Ecobee to off.

I hope this helps.

Link to comment
Share on other sites

@DLite I switched to your way, using the numeric variable, and things work flawlessly.  It was way simpler and more elegant than all of my "ifs" and "ors."   Count goes up when things open, down when they close, opening starts the timer, HVAC goes off when it expires, timer stops when everything is closed and HVAC goes back to auto.

 

Thanks again.

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.