Author Topic: If door is opened for 5 minutes...turn off air  (Read 37818 times)

Offline bennynations

  • Full Member
  • ***
  • Posts: 136
  • Karma: +0/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #15 on: September 08, 2010, 09:36:30 pm »
thanks for the advice, but I am lucky to just cut/paste advice.  LOL

Here is what is running now:

os.execute("sleep 5")

if( luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped",11)=="0" ) then   
   luup.log("Sensor Not Tripped, ending scene")   
    return false
end

I am not concerned about turning the air back on.  The guest has been told that leaving the door open will turn the AC off.

2 Schlage locks, Trane Thermostat, Leviton lights and fan control

Offline reiserx

  • Sr. Member
  • ****
  • Posts: 297
  • Karma: +0/-1
Re: If door is opened for 5 minutes...turn off air
« Reply #16 on: September 09, 2010, 02:46:15 am »
I would have it set for 1 minute. It shouldn't take that long to get luggage inside. I may even make it 30 seconds. Let them suffer for being stupid and wasting energy. I had a tenant leave all the windows open with the air on too. When I saw it I just shut off  the air remotley from my phone. Then I found out they wern't even there all day. Grrrrr.

Offline bennynations

  • Full Member
  • ***
  • Posts: 136
  • Karma: +0/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #17 on: September 09, 2010, 09:27:23 am »
This is a balcony door.  The problem is that guests will go hang out on the balcony and leave the door open or they like the breeze from the Gulf and will just leave it open while inside the condo.  Either way, others owners seem to always complain it and I want to fix it before it happens to me.

I think the code that fall-line provided is working now that I know how to insert it. 

I still do not understand why running the scene remotely would actually turn the AC off since the patio door is closed.
2 Schlage locks, Trane Thermostat, Leviton lights and fan control

Offline Les F

  • Hero Member
  • *****
  • Posts: 557
  • Karma: +7/-0
    • When not home, I can be found at the cabin
Re: If door is opened for 5 minutes...turn off air
« Reply #18 on: September 09, 2010, 09:53:20 am »

I am not an expert in when a plugin will work or how much it can really do... but there should be a 'rental / vacation home' plugin.   I guess there are too many differences in all of our places... motion sensors, door sensors,  (or info fed via alarm panel)... but this would be great for many people and perhaps even a selling point for MCV/Vera.  It could save a small fortune in utility costs for us rental owners. 

The person at my cabin this week has been playing the game of leaving the door open and the A/C on.   It's amazing what we didn't know in the past about guests and their habits. This is the first summer that I had vera online and it's an eye opener for sure.

 
Google+ http://tinyurl.com/7hewkbn / Instagram: https://goo.gl/0Hr8K4 / Pinterest https://goo.gl/WjZCQp (Yes, Pinterest is for guys too! take a look)

Offline bennynations

  • Full Member
  • ***
  • Posts: 136
  • Karma: +0/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #19 on: September 09, 2010, 10:12:28 am »
Good point Les! It would be beneficial. The current problem is that, while Vera is relatively easy to set-up, every individual will have something that they want "outside of the VERA box."  The Lua code is great for programmers, but it is not easily understood by the average Benny.  ;D


 
2 Schlage locks, Trane Thermostat, Leviton lights and fan control

Offline fall-line

  • Beta Testers
  • Full Member
  • *****
  • Posts: 248
  • Karma: +1/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #20 on: September 14, 2010, 07:05:03 pm »
@bennynations,

I tried my original code at home last night and got mixed results. After reviewing it more carefully, I think the logic is sound, but I made some poor choices in code when trying to write something off the cuff for you. With that in mind, I'd like to submit another attempt. This works much more reliably for me, and I believe it will for you as well. You can either use this to setup your scene to execute the commands as you already have them, or you can build the commands right into the code if you prefer. Here is the new code:
Code: [Select]

function checkdoorstatus()
  if( luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped",38)=="0" ) then
luup.log("Sensor Not Tripped, ending scene")
   stilltripped = "0"
  else
luup.log("Sensor is still tripped!")
   stilltripped = "1"
  end
end

luup.call_timer("checkdoorstatus", 1, "5m", "", "")

if (stilltripped == "0") then
   return false
end

Note: This code uses the call_timer function to implement a cleaner/friendlier 5 minute delay (see the 5m designation in there). You can change "5m" to just "2" if you want to go back to a 2 second delay for testing.

If you want to build the command right into the code, just replace the last bit with something like this:
Code: [Select]
if (stilltripped == "1") then
   luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="0" },37)
end    
This would turn off a switch with the device # 37 if the sensor is still tripped.

« Last Edit: September 14, 2010, 07:12:34 pm by fall-line »

Offline ravennevar

  • Beta Testers
  • Jr. Member
  • *****
  • Posts: 87
  • Karma: +0/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #21 on: September 16, 2010, 10:54:15 pm »
@bennynations:

Which device are you using to turn on/off your AC? I have a few 220-240v ACs that could benefit from such a device and would definitely be something worth adding to my Zwave network.

Offline aecchalet

  • Full Member
  • ***
  • Posts: 221
  • Karma: +1/-1
Re: If door is opened for 5 minutes...turn off air
« Reply #22 on: September 27, 2010, 06:14:08 pm »
I am also very interested in this application.  I wrote to micasaverde to see if their support would help me implement it.  They said that for $300, they would write a plug in that they would also make available for all vera users.  However have one of you already developed the plug in to do this?  If so, is this plug in currently located in the MIOS Market?  If it is, what is the name?  If the plug in is not located there, is there another way that I can obtain it?
Thanks
(As you can tell, I am a beginning user.)
Vera Plus 1.7.2138; 12xHRDS1, 2xTrane SCHTZMT400 Tstats; 5xZIR00, 4xCA9000 PIRs; 2xHA01C Recept; 2x2wy ZDW120W switch; 2xAppl (ACT, GE/Jasco), 6xLite Dim Mod (GE/Jasco, Evolve);  2xDead Bolt Schlage

Offline Les F

  • Hero Member
  • *****
  • Posts: 557
  • Karma: +7/-0
    • When not home, I can be found at the cabin
Re: If door is opened for 5 minutes...turn off air
« Reply #23 on: September 27, 2010, 06:30:20 pm »

Don't they (MCV) get it?   Instead of charging someone $300 for this, it could be a STRONG selling point for rental owners.   Did MCV forget whats on the front page... "Cut your energy bill" .  This is something that everyday people as well as rental owners could use to actually cut their energy bill.

I have had other rental owners ask me how I am able to remotely set the thermostat etc... They think thats cool. (no pun intended).  However if I told them they could shut down A/C automatically on a door staying open they would probably be a lot more inclined to try it out for their own property.  (Yeah they are capable of dealing with the tech side of vera when she gets cranky)

Google+ http://tinyurl.com/7hewkbn / Instagram: https://goo.gl/0Hr8K4 / Pinterest https://goo.gl/WjZCQp (Yes, Pinterest is for guys too! take a look)

Offline aecchalet

  • Full Member
  • ***
  • Posts: 221
  • Karma: +1/-1
Re: If door is opened for 5 minutes...turn off air
« Reply #24 on: March 02, 2011, 01:43:16 pm »
I have 2 trane thermostats and 6 Hawking HRDS1 sensors on windows and doors installed.  Is there anyone that can help me write and install a program to shut off the AC if the door or window is open for 5 min?  I saw that some code has been suggested but I am uncertain how to modify it and how to apply it.
I have a Vera2 and I think that I just updated the latest firmware although I am having to have someone power cycle it for me.
Thanks
Tom
Vera Plus 1.7.2138; 12xHRDS1, 2xTrane SCHTZMT400 Tstats; 5xZIR00, 4xCA9000 PIRs; 2xHA01C Recept; 2x2wy ZDW120W switch; 2xAppl (ACT, GE/Jasco), 6xLite Dim Mod (GE/Jasco, Evolve);  2xDead Bolt Schlage

Offline fall-line

  • Beta Testers
  • Full Member
  • *****
  • Posts: 248
  • Karma: +1/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #25 on: March 02, 2011, 02:51:36 pm »
Hi aecchalet,

if you can let us know the device IDs for the door senors, as well as the thermostat, I bet we can come up with something useful for you.

You can find the device IDs by clicking the wrench icon, and clicking the Advanced Tab. The device ID will be listed at the top (e.g. Device #37).


Offline aecchalet

  • Full Member
  • ***
  • Posts: 221
  • Karma: +1/-1
Re: If door is opened for 5 minutes...turn off air
« Reply #26 on: March 27, 2011, 01:14:04 pm »
My functioning HRDS1 window/door sensor device#s are 9, 10, 12.  I have 3-4 more sensors that are not functioning properly yet but I am working on them! My trane thermostat device#s are 4, 16.
Thanks!!
Vera Plus 1.7.2138; 12xHRDS1, 2xTrane SCHTZMT400 Tstats; 5xZIR00, 4xCA9000 PIRs; 2xHA01C Recept; 2x2wy ZDW120W switch; 2xAppl (ACT, GE/Jasco), 6xLite Dim Mod (GE/Jasco, Evolve);  2xDead Bolt Schlage

Offline aecchalet

  • Full Member
  • ***
  • Posts: 221
  • Karma: +1/-1
Re: If door is opened for 5 minutes...turn off air
« Reply #27 on: April 04, 2011, 10:39:06 pm »
Has anyone gotten the script to work? Can someone help me write a script for my installation?
Thanks
Vera Plus 1.7.2138; 12xHRDS1, 2xTrane SCHTZMT400 Tstats; 5xZIR00, 4xCA9000 PIRs; 2xHA01C Recept; 2x2wy ZDW120W switch; 2xAppl (ACT, GE/Jasco), 6xLite Dim Mod (GE/Jasco, Evolve);  2xDead Bolt Schlage

Offline fall-line

  • Beta Testers
  • Full Member
  • *****
  • Posts: 248
  • Karma: +1/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #28 on: April 05, 2011, 07:02:58 pm »
Here is something you can try. This script is intended to be run periodically. It is a little more simplified than the original request, but this is probably the way I would accomplish what you are trying to do if it were me. Especially for a vacation home with needy guests, simple is always better.

Use this code in a scene that runs every N minutes (perhaps 5?). Each time it runs, it will check to see if ANY of the defined sensors are tripped. If so, it will turn the operating mode on ALL defined thermostats to OFF. Otherwise (if none of the sensors are tripped), it will turn the operating mode on ALL the defined thermostats to AUTO (auto switches between heat/cool as required by the set point).

Since this will run periodically, the amount of time from the window/door being opened until the A/C being turned off will vary (anywhere between 1 second and N minutes), but it accomplishes the shutoff and turn (back) on functionality all in one scene. When someone opens a door and leaves it open, the thermostat will be shut off on the next run of this scene. When they close the door (and no other sensors are tripped) the thermostat will go back to auto on the next pass.

I hope this helps you see how this can be accomplished. I would personally strongly recommend that you become familiar with the code and how to read and modify it however before implementing this in a home that you are renting to guests. You don't want to have goofy things happening to your paying customers.


Code: [Select]
-- user configurable values ------------------------------------------------------------
--
--

-- List of all of your Sensor Devices that you would like to be included in the checks.
sensors = {9, 10, 12}

-- List all thermostats that you would like controlled as a result
thermostats = {4, 16}


--
--
-- end of user configurable values -----------------------------------------------------



-- Assume that no sensors are tripped to begin the script.
anytripped = 0

-- Check each sensor defined above. If it is tripped, set the global tripped status.
for  k, v in pairs(sensors)
do

  if( luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped",v)=="0" )  
  then
luup.log("Sensor "..v.." Not Tripped")

  else
luup.log("Sensor "..v.." is tripped!")
anytripped = 1
  end
end


-- Configure each thermostat defined above. If the global tripped status is set, turn the
-- thermostat OFF, otherwise, turn it to AUTO.

for  k, v in pairs(thermostats)
       do



if (anytripped == 1) then

       luup.log("Setting Mode on Thermostat "..v.." to OFF")
luup.variable_set("urn:upnp-org:serviceId:HVAC_UserOperatingMode1", "ModeStatus",  "Off", v)
else
       luup.log("Setting Mode on Thermostat "..v.." to AutoChangeOver")
luup.variable_set("urn:upnp-org:serviceId:HVAC_UserOperatingMode1", "ModeStatus",  "AutoChangeOver", v)
end
end




Good luck!
« Last Edit: April 06, 2011, 11:52:59 am by fall-line »

Offline Ap15e

  • Beta Testers
  • Sr. Hero Member
  • *****
  • Posts: 2000
  • Karma: +11/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #29 on: April 06, 2011, 04:17:49 am »
@fall-line

If the last sensor isn't tripped, anytripped is 0 - regardless of the state of the other sensors. Is this working as intended?