If door is opened for 5 minutes...turn off air


I have guests that love to leave the patio door open while sitting outside. Is there some way trigger something that says if the door is open for so long…turn off the air???



For starters, you can try having the door sensor in the armed state. You can create an event when the armed sensor is tripped. On the advanced tab set a 300 second delay (5 minutes). The command tab action is turn HVAC off. I have not done this before, but I believe you will also want to create an HVAC resume scene where every 15 minutes or so, turn the HVAC back on if the door sensor is closed. It is obviously possible to shut off the HVAC immediately when the door opens, so try the delay and let us know how it works for you.



I understand that method, but I am looking for something that, once the sensor is triggered, monitor how long it is opened, if opened at 5 minutes, turn off the A/C.



Does anyone have any ideas??



So I haven’t done this (and I am actually following this thread, hoping that someone who has will reply and confirm), but my strategy would be as follows.

Scene Event: Armed Sensor is tripped

Luup logic:
*Sleep for 5 minutes

  • then check status of sensor.
    • If sensor is no longer tripped
      * end.
    • otherwise
      * continue to execute

Essentially what you would have here is the scene firing when the door is opened, but all the scene will do for 5 minutes is sit there watching the clock. Once the 5 minutes has expired, it’ll manually (via luup code) check the status of the sensor again, and if it is still in a tripped state, then it’ll execute the commands. In your case, it’d be to turn off the AC appliance control module (which is a very good idea btw). In my case, it’d be to send me an email saying you left the door open again.

I think this’ll work, and the LUUP code would be pretty straightforward. I could write it up, but I’m sure someone has done it before.

Any comments from those that have done it?




I think this works. Here is my code:

os.execute("sleep 2")

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

Note I have this set to sleep for only 2 seconds for testing, you’ll want to change it to 300 for 5 minutes. The other thing you’ll want to change is the device id (mine is 33) to match your Device.



I am basically an end-user, so the code will be an interesting test for me.


Can I test this remotely, or do I actually have to trigger the scene event??



I tried to get this to work, but I kept getting invalid scene.




What happens if you paste the code into the LUUP test window and hit go? This window can be found on UI2 in:

Devices -> Luup Plugins -> Test Luup code (Lua) - this last one is a button.

I’m not sure where this is in UI3 or 4, but I imagine it is easy to find.

You should be able to paste it in there and hit go to test, where you can absolutely test it remotely. Just remember you’ll need to change the device ID (my example uses device 33) to the device number used by your sensor.



I found the area and entered the code…it says bad device

I looked at my device and it says that urn:schemas-micasaverde-com:device:MotionSensor:1

My device is number 11

I entered the following:

os.execute(“sleep 2”)

if( luup.variable_get(“urn:schemas-micasaverde-com:device:MotionSensor:1”, “Tripped”,11)==“0” ) then
luup.log(“Sensor Not Tripped, ending scene”)
return false

No luck



Both of my door sensors (Both Hawkin HRDS1) also show up in their advanced properties as “urn:schemas-micasaverde-com:device:MotionSensor:1”, but when I query the status I found I need to use urn:micasaverde-com:serviceId:SecuritySensor1… I’m not exactly sure why that is.

I assume you tried my original snipit with just changing the device number as well, yes?



Also, unless you aere on UI4 you don’t need to put the device ID in the “Device Number” field next to the go button, just leave that blank since the device is specified in the code already. If I enter my device number in that field, I get the bad device error as well.



I am on Vera2 and UI4. I got it to work and then saved it in the scene. Now that I run the scene remotely, I get “empty response.”

At least it saved it properly, but I am not sure what to do now.



Thanks so much for the help!! Nice to learn more about this.

Everything is saved and appears to be working. It is saved as a scene. When I run the scene, it transmits and turns the air off.

Is this correct?? If it is checking the status, the door is still closed. Should it turn the AC off??



Just one extra piece of logic in case you didn’t cover it.

If door is opened for 5 minutes and air is already off don’t do anything.

(you wouldn’t want to turn the air on 15 minutes later if it was never on to start with)



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

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.



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.



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.



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.



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