Jump to content
C4 Forums | Control4

Turning off AC based on open and window door states


Dave w

Recommended Posts

What I'm trying to accomplish: When Master Door A or B or C = Open for 5 mins+ Turn Off AC. When ALL are Closed return AC back to Normal.

This is the script I wrote....but its not working to shut AC off.  I think the timer is the issue.  Any thoughts?  (assume devices, timer, and variable have proper names)

When Door A opens
 Set Var +1
When Door A Closes
 Set Var -1
When Door B opens
 Set Var +1
When Door B Closes
 Set Var -1
When Door C opens
 Set Var +1
When Door C Closes
 Set Var -1

When Var Changes
 If > 0 Set Timer 5 mins
 If = 0
  Set AC  = Normal
  Stop Timer

When Timer Expires
 Set AC = Off
 

Link to comment
Share on other sites


If I'm understanding correctly - you want the AC off if a door has been opened for more than five minutes, and when all doors are shut, turn back on the AC. Now I don't have any way of testing this, and I don't like "when variable changes," so give this code a try and let me know if it works. Might need some additional tweaking.

When DoorA opens
  do DoorOpenMacro                    !I like macros - helps keep code in one place
When DoorA closes
  do DoorCloseMacro
etc.
 
---
DoorOpenMacro

DoorVar += 1
if DoorVar = 1                              !if more than one we've already done this
  ACVar = status of AC                !need to know status of AC - it could be off - like in winter (if you need help with this code let me know)
  if ACVar = on
    Start 5MinuteTimer
 
---
DoorCloseMacro

DoorVar -= 1
if DoorVar = 0
  Stop 5MinuteTimer                   !this line of code is actually not necessary - can wait till timer expires
  if ACVar = off
    start AC

---
When 5MinuteTimer expires
  if DoorVar > 0                          !is door still open?
    stop AC
    ACVar = off

Link to comment
Share on other sites

Another option (if you are using a security system and driver that supports groups - e.g. DSC) is to create a group that includes all the relevant doors and windows.  When the group is activated (one open) you turn off the air con (or, if you want a 5 minute delay, use a timer and now check if the timer is running, if not start the timer - when the timer expires turn off the aircon) and when it is deactivated (all closed) you turn the aircon back on (and stop the timer if you are using one).

You (actually your dealer) can also link the group to an Experience button that will show you if anything is open or if everything is closed...

Link to comment
Share on other sites

When Door A opens
    If Timer is not running

        Restart Timer
When Door A Closes
    if door a is closed

        if door b is closed

            if door c is closed

                Stop Timer
When Door B opens

    If Timer is not running

        Restart Timer
When Door B Closes

    if door a is closed

        if door b is closed

            if door c is closed

                Stop Timer
When Door C opens

    If Timer is not running

        Restart Timer

When Door C Closes

    if door a is closed

        if door b is closed

            if door c is closed

                Stop Timer

When Timer Expires
 Set AC = Off

Link to comment
Share on other sites

  • 4 years later...
  • 2 months later...
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.