We have moved at community.getvera.com

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

Offline Fred S

  • Sr. Newbie
  • *
  • Posts: 48
  • Karma: +0/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #105 on: April 08, 2013, 10:23:09 pm »
OK I think I get it. So basically it?s an expression within an expression. (I applied it BTW and it worked flawlessly... thank you.)

Could I apply that to another scenario I have? Essentially I?d like my front lights to turn on at night but only if my alarm is armed. I?m thinking I need to create a trigger for AlarmArmed as well as either a schedule for sunset or use the night or day plugin.

Offline RichardTSchaefer

  • Community Beta
  • Master Member
  • ******
  • Posts: 10091
  • Karma: +764/-143
Re: If door is opened for 5 minutes...turn off air
« Reply #106 on: April 08, 2013, 10:29:16 pm »
You can use Day or Night.
You do not need a Schedule ...
You could do the following:

LightOn:     ALARM and (NOT (7:00:00; NOW; 19:00:00))

With Day or Night:

LigtOn:    ALARM and NIGHT

Offline Fred S

  • Sr. Newbie
  • *
  • Posts: 48
  • Karma: +0/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #107 on: April 09, 2013, 10:06:48 pm »
Hi Richard. OK so what I'm understanding is that LightOn:     ALARM and (NOT (7:00:00; NOW; 19:00:00)) would essentially be referencing an absolute value. Basically if the alarm is set between 7 pm and 7 am the lights would be on. the same with Day or night except day or night app would automatically adjust for sunrise and sunset.

I did the latter code LightOn:    ALARM and NIGHT but it didn't turn on via a schedule automatically however it did turn on and off when I armed and disarmed my alarm at night. I think I'm half way there. My scenario would be I set me alarm during the day so the lights would be off but nightfall comes before I disarm my alarm. I'd want the lights to turn on at night but only if my alarm was armed. I hope that makes sense. Thanks again for helping me with this fantastic app!!

Offline RichardTSchaefer

  • Community Beta
  • Master Member
  • ******
  • Posts: 10091
  • Karma: +764/-143
Re: If door is opened for 5 minutes...turn off air
« Reply #108 on: April 10, 2013, 08:18:20 am »
That should work ... And you can test this all day or night ... Just toggle your Alarm and/or the Day Or Night switch.

Make sure you have setup your TimeZone AND Location properly in the Vera Setup tab. Otherwise it will not compute the Day and Night time properly.
 
« Last Edit: April 10, 2013, 08:20:39 am by RichardTSchaefer »

Offline Fred S

  • Sr. Newbie
  • *
  • Posts: 48
  • Karma: +0/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #109 on: April 15, 2013, 09:42:10 pm »
Hi Richard. I didn't want you to think I left you hanging there. I needed to apply what you wrote. I did finally get the (AlarmArmed and Night) expression to work. The problem was that I had two different triggers. (AlarmArmed and Night) which would turn my front lights on if it was armed and night. I also had a counter trigger and expression (AlarmDisarmed and Night) which would turn my front lights off. The problem so it would seem is that only the counter trigger was working so essentially my front light would turn off when night came. I'm not understanding why this would happen though as I was using two different triggers and expressions. The only common factor was "night."

Offline RichardTSchaefer

  • Community Beta
  • Master Member
  • ******
  • Posts: 10091
  • Karma: +764/-143
Re: If door is opened for 5 minutes...turn off air
« Reply #110 on: April 16, 2013, 08:52:02 am »
EMAIL me your PLEG report.

Offline Fred S

  • Sr. Newbie
  • *
  • Posts: 48
  • Karma: +0/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #111 on: April 16, 2013, 07:16:01 pm »
Richard, I emailed you the report as per your request. Please let me know if you have any questions and thanks.

Offline Les F

  • Hero Member
  • *****
  • Posts: 567
  • Karma: +7/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #112 on: April 22, 2013, 07:36:35 am »

When you get the bugs out, please post the full setup, I can use this at my cabin... people always leaving the doors open and A/C on!
Google+ http://bit.ly/2MAVlkR / Instagram: http://bit.ly/2lIcsFT / Pinterest http://bit.ly/2KCSYRm (Yes, Pinterest is for guys too! take a look)

Offline linkinx

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #113 on: April 24, 2013, 03:33:42 pm »

When you get the bugs out, please post the full setup, I can use this at my cabin... people always leaving the doors open and A/C on!

I also would like this, I do not want the A/C shutoff just a notification of hey idiot someone probably left the door open... I seem to often not fully shut my (inside) garage door...

Offline SOlivas

  • Sr. Member
  • ****
  • Posts: 282
  • Karma: +1/-1
Re: If door is opened for 5 minutes...turn off air
« Reply #114 on: August 06, 2013, 02:33:09 am »
Quote from: SOlivas
See at the end of this for a list of updates/fixed to this code

Ok, I got bored and wanted to try my hand at making the initial code that mcvflorin posted into a plugin, with a few additional features.  I know that there is a SmartVirtualThermostat Plugin already in the apps store (I have not tried it), and because of this, I will only post the code here (for now).  This plugin does not implement the later modification posted to accommodate motion sensors, but I may try this in a future version.

I call this plugin:  Window, Door, and Sensor Control HVAC (WDSC HVAC) plugin v1.0

I moved the files for this plugin here:

http://forum.micasaverde.com/index.php/topic,15982.msg121764.html#msg121764



This should make it easier to find, instead of having to dig several pages into this topic to find the code/files.
« Last Edit: August 07, 2013, 02:04:06 am by SOlivas »
Vera 3 (1.5.622) / 9x GE/Jasco 45609 / 2x GE/Jasco 45612 / 2x GE/Jasco 45614 / 1x MIMO Lite
1x Twine (http://forum.micasaverde.com/index.php/topic,15617.0.html), DSC Security System, Honeywell  YTH8320ZW1007 Thermostat, 1x Fortrezz WWA-01, 1x CA9000 Wireless PIR Sensor

Offline Les F

  • Hero Member
  • *****
  • Posts: 567
  • Karma: +7/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #115 on: August 06, 2013, 06:27:18 am »

Interesting...   I never got around to implementing anything in ref to this, but will play around this weekend.
Thanks for posting!
Google+ http://bit.ly/2MAVlkR / Instagram: http://bit.ly/2lIcsFT / Pinterest http://bit.ly/2KCSYRm (Yes, Pinterest is for guys too! take a look)

Offline SOlivas

  • Sr. Member
  • ****
  • Posts: 282
  • Karma: +1/-1
Re: If door is opened for 5 minutes...turn off air
« Reply #116 on: October 04, 2013, 01:52:35 am »
I just posted an update that lets you use temperature sensors as well as door/window sensors to control your thermostat.

Vera 3 (1.5.622) / 9x GE/Jasco 45609 / 2x GE/Jasco 45612 / 2x GE/Jasco 45614 / 1x MIMO Lite
1x Twine (http://forum.micasaverde.com/index.php/topic,15617.0.html), DSC Security System, Honeywell  YTH8320ZW1007 Thermostat, 1x Fortrezz WWA-01, 1x CA9000 Wireless PIR Sensor

Offline ryandidur

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #117 on: June 14, 2014, 06:43:01 pm »
For Vera to work properly this has to be broken into two steps.

  • Detect Door or Window Opened ... Initiate Timer
  • When the timer expires do some additional work
The plugins I have listed will do this for you.
If you call Sleep ... it causes ALL of VERA to sleep. It will not respond to any other inputs during that period ... If it's long enough it will restart it self ... because it's not responding.

I would like to disable all three of my nest thermostats if any door or window is left open for more than 5 minutes. I can't figure out how to setup PLEG or PLET to do this. Are you able to provide details as to how I can set this up.

Thanks


Offline SOlivas

  • Sr. Member
  • ****
  • Posts: 282
  • Karma: +1/-1
Re: If door is opened for 5 minutes...turn off air
« Reply #118 on: July 05, 2014, 03:42:46 am »
@ryandidur,
There is a plugin version of this that should do what you want - no coding with PLEG is needed.

Take a look at:

http://forum.micasaverde.com/index.php/topic,15982.msg121764.html#msg121764

You can define multiple thermostats that you want to have controlled.

--

For PLEG, I would recommend you take a look at the information about this plugin elsewhere on this forum.  There are a lot of really good examples of how to do things with it. 
« Last Edit: July 05, 2014, 03:44:30 am by SOlivas »
Vera 3 (1.5.622) / 9x GE/Jasco 45609 / 2x GE/Jasco 45612 / 2x GE/Jasco 45614 / 1x MIMO Lite
1x Twine (http://forum.micasaverde.com/index.php/topic,15617.0.html), DSC Security System, Honeywell  YTH8320ZW1007 Thermostat, 1x Fortrezz WWA-01, 1x CA9000 Wireless PIR Sensor

Offline klopfensteinj

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Re: If door is opened for 5 minutes...turn off air
« Reply #119 on: April 25, 2016, 02:13:54 pm »
Below are two code snippets I copied from the wiki that work like a charm if placed in two separate scenes. They each only look at one sensor and do not detect the status of the ac unit before firing to avoid turning on a unit that was manually turned off.

How would one combine them to:
* work within one scene
* Check the status of the ac unit and if off leave off
* check multiple sensors (doors & windows) closed or not tripped
* Return it to the mode it was in when the scene was triggered. (for those units without AUTO)

I can configure the scene with triggers for the doors/windows opening and closing, so triggers are not a problem.

I use the following two lines to check the status of a light to not run the scene if the light is already on manually. Will this work for the thermostat as well?

light = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1","Status",3)
return (light == "1")

If so, I am not sure how to incorporate that into what I want to happen.
-----------------------------------------------------
-- Turn AC off when Doors/windows opened for 5 minuets

local SENSOR = 17    -- The door/window sensor device number
local THERMOSTAT = 3 -- The thermostat device number
local DELAY = 300    -- Seconds
 
local SES_SID = "urn:micasaverde-com:serviceId:SecuritySensor1"
local HVACO_SID = "urn:upnp-org:serviceId:HVAC_UserOperatingMode1"
 
luup.call_delay( "turnOffAc", DELAY)
 
-- Turn off the thermostat if the sensor has been tripped for at least 5 minutes.
function turnOffAc()
    local tripped = luup.variable_get( SES_SID, "Tripped", SENSOR) or "0"
    local lastTrip = luup.variable_get( SES_SID, "LastTrip", SENSOR) or os.time()
    if (tripped == "1" and (os.time() - lastTrip >= DELAY)) then
        local modeStatus = luup.variable_get( HVACO_SID, "ModeStatus", THERMOSTAT) or "Off"
        luup.variable_set( HVACO_SID, "LastModeStatus", modeStatus, THERMOSTAT)
        luup.call_action( HVACO_SID, "SetModeTarget", {NewModeTarget = "Off"}, THERMOSTAT)
    end
end

-------------------------------------------------

-- Turn on when doors/windows closed for 10 minuets

local SENSOR = 17    -- The door/window sensor device number
local THERMOSTAT = 3 -- The thermostat device number
local DELAY = 600    -- Seconds
 
local SES_SID = "urn:micasaverde-com:serviceId:SecuritySensor1"
local HVACO_SID = "urn:upnp-org:serviceId:HVAC_UserOperatingMode1"
 
luup.call_delay( "turnOnAc", DELAY)
 
-- Turn on the thermostat if the sensor hasn't been tripped in the past 10 minutes.
function turnOnAc()
    local tripped = luup.variable_get( SES_SID, "Tripped", DOOR_SENSOR) or "0"
    local lastTrip = luup.variable_get( SES_SID, "LastTrip", DOOR_SENSOR) or os.time()
    if (tripped == "0" and (os.time() - lastTrip >= DELAY)) then
        local lastModeStatus = luup.variable_get( HVACO_SID, "LastModeStatus", THERMOSTAT) or "Off"
        luup.call_action( HVACO_SID, "SetModeTarget", {NewModeTarget = lastModeStatus}, THERMOSTAT)
    end
end

I use this code and after figuring out my triggers to get the scene to turn back on it works great.  One question, I am using this with one sensor, is there a way to list a number of sensors in the code?  My alarm has a wireless sensor on each window and door and would to have this condition for more than one sensor w/o having a scene per sensor.
Thinking like local SENSOR = 17, 18, 19    -- The door/window sensor device number

Thanks