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

I recently updated to Vera Plus from Vera 3 and undated the firmware to 1.7.2138. I was speaking with Vera support about problems with getting my vera 3 online when I made this decision so they helped me with the transition. They recommended that I not transfer my scenes and devices but recreate them. This should make the system perform much more quickly.
I decided to take Richard T. Schaffer’s advice and try to do this with PLEG. (I had some trouble loading PLEG and PLC, which are the subject of another string.)
I would appreciate any comments on my first PLEG device, described below.

I created inputs using a trigger for each window and door sensor and each motion detector being tripped.
Here is the condition that I created, which would be positive when any sensored door or window was open for more than 60 seconds:
DoorWinOpen = ( tLFrBRWnOpen and ( tLFrBRWnOpen; Now > 00:60)) or ( tLHallWnOpen and ( tLHallWnOpen ; Now > 00:60)) or ( tLBkBRDrOpen and ( tLBkBRDrOpen; Now > 00:60)) or ( tLHallDrOpen and ( tLHallDrOpen; Now > 00:60)) or ( tLFrBRDrOpen and ( tLFrBRDrOpen; Now > 00:60)) or ( tLMstrBRDrOpen and ( tLMstrBRDrOpen; Now > 00:60)) or ( tULanaiDrOpen and ( tULanaiDrOpen; Now > 00:60)) or ( tUHallWnOpen; Now > 00:60)) or ( tUFrDrOpen and ( tUFrDrOpen; Now > 00:60)) or ( tUMstrBRWnOpen and ( tUMstrBRWnOpen; Now > 00:60))

Here is the condition that I created, which would be positive when it has been more than 30 minutes since any motion detector had tripped between the hours of 9 AM and 5 PM:
MDNotTrip = ( tLHallMDTrip; Now > 30:00) and ( tLMstrBRMDTrip; Now > 30:00) and ( tUGRMDTrip; Now > 30:00) and ( tUMstrBRMDTrip; Now > 30:00) and ( tUFoyMDTrip; Now > 30:00) and (09:00:00 < NOW < 17:00:00)

Then I created a logical action, which would be activated and change the SetModeTarget for each of of my 2 Trane thermostats to Off whenever the above conditions were true. Do I need to make that “Off”? (I set options to repeat for these actions.)

The PLEG instructions say that I must restart Vera and reload browser for any newly created PLEG device to work properly. Does that mean remotely reboot?
The instructions also say to click the Reload Luup button on the inputs, conditions or actions page. My UI7 editor doesn’t have a Reload Luup button on those pages but there is a Reload Lua button on editor options button drop down and a save changes button under the PLEG device. I hit both of those. Anything else that I need to do to save this? Where is the backup button?

Do these conditions and logical actions look correct?

I need to test this PLEG device remotely, since I am 3000 mi away. I can set my thermostats on remotely and check remotely to see if they stay on so I don’t need a dummy device to be acted upon. Any suggestion on how I can test the conditions remotely? I understand that I should make a dummy door/window sensor and trip it but don’t know how to do either of these. If I am supposed to use a virtualswitch and/or variablecontainer to do the test I don’t understand how.

Thanks for any help!

My guest just arrived so I have people triggering motion detectors. The motion detection part of this script doesn’t work properly. I rebooted vera and refreshed the browser then armed the PLEG device. At that point, no one had trigger a motion detector or opened a door or window but it kept shutting off my AC within a minute of me turning it on. I know it was the PLEG device because it stopped shutting off the AC when I put in in bypass mode. Because this happened so quickly (<= 1 min), can I presume that the problem is in the DoorWinOpen condition? It was 4 pm there so the time interval was true.
Anyone see any obvious mistakes?
Thanks

I tend to ignore requests that do not include a STATUS report generated at the time of the problem to see both your logic and the state and sequence of Inputs and Conditions.

Richard, It has been a year since I wrote the PLEG program to control my AC. I only visit my home 4 times a year and have had a variety of problems with sensors and locks but everything appears to be stable. How do I generate a STATUS report?
Do I need to create a schedule in order for the PLEG programs to run all of the time?
I have wasted a lot of money on AC in the past year and would like to get these controls running. Thanks for any assistance that you can give.

Try this:

I made some changes to my devices then went to editor options/reload Lua. Then I clicked on status report and nothing happened.

Make sure pop ups are enabled. You will get a new browser window with the status report. You can then save/print it as a PDF and upload it here. Here is a sample.

OK, with some help, I figured out how to view a status report and to reload Lua after making any changes (much faster than rebooting Vera).
My triggers and condition seem to work fine but the problem is with the Logic Action. I want to shut my AC off via my Trane TZ43 thermostats. It appears that my only logical choices for Actions are Set Mode (OFF), Set Target (0) and Set Mode Target (OFF). None of these choices turn off the cooling or change the Mode Status from CoolOn to Off. How do I change the thermostat Variable Mode Status from CoolOn to Off, which is not in my list of actions under PLEG for that device? Anyone familiar with controlling this thermostat via PLEG?
I then made a scene where I used my PLEG condition and then used this thermostat’s UI to click on the OFF mode. That works fine but I would prefer to do this with a PLEG Logic action.

I have a similar problem with a Logic Action for an outlet. My only logical choice within PLEG is Set Target but that won’t turn the outlet on. I need a way to change the outlet variable Status from 0 to 1 but it doesn’t appear in my list of available PLEG actions. Any ideas for each of these devices?

I found a luup command from oTi@ that allows me to change Mode Status (runMode) to Off:
luup.call_action(‘urn:micasaverde-com:serviceId:ZWaveNetwork1’,‘SendData’,{Node=‘’, Data=‘64 1 ’},0)
Where is the Z-Wave NodeID (Settings->ID / Advanced->altid), so not the Device#, of the t-stat, and is:
0: off
1: heating
2: cooling
3: auto
4: e-heat

I understand that I would enter it in the Lua field for my Logic Action.
Do I toggle on “save output as logic variable”?
Is there a specific name that I should give this logic variable?
I am not sure what to do with this now. This is the action that I want to take when my condition is true.
How do I execute this action?
Do I leave everything below this step blank?

luup.call_action(‘urn:micasaverde-com:serviceId:ZWaveNetwork1’,‘SendData’,{Node=‘38’, Data=‘64 1 ’},0)
I still haven’t figured out how to get the above Luup call to change the value of the thermostat mode status to OFF by entering it in the Luu box of a logical action.
I found that another logic action option for my thermostat is “Send Data”. The first field is Node for which I entered 38 (identifies the particular thermostat device). The next field is Value. Not surprisingly, 0 doesn’t work probably because I didn’t specify which variable I want to set at 0. However, I wasn’t given the option to enter ‘64 1 ’ any where. I tried entering ‘64 1 , 0’ in the Value field but that didn’t work. Is there a certain format that I can use to enter this data in the fields of a logic action under “Send Data”?
Essentially, I am trying to find a way to turn off my Trane thermostat within PLEG. It appears that I want to change the ModeStatus to Off but that is not an option for my thermostat in PLEG. I can’t find a way to enter the Luup.call_action above as a logical action. Does anyone know if my Node=‘38’, Data=‘64 1 ’ variables are correct for the modestatus variable?

I still haven’t figured out why I can’t shut off my AC at my thermostats with PLEG. I created devices for each door & window sensor. I created a condition to be true when any of the door or window sensors are open for more than 60 secs. My problem is that I can’t get my logical action to work properly. I chose the desired condition then select both thermostats. It appears that my only drop down logical choice is ModeTarget = Off. When I test the logical action after saving it and clicking the run button, the status report indicates that the ModeTarget has been correctly changed to Off. However, it doesn’t shut off my AC. When I open the thermostat device in UI7 of the AC unit that is running, go to advanced and then the variables tab, the ModeTarget is still set on CoolOn. The same thing happens when I try to create a logical action to turn on the AC by changing the ModeTarget to CoolOn. The status report will indicate that the ModeTarget is CoolOn but the AC will not turn on and the Variable field in the thermostat is still Off.
My work around has been to use that condition to trigger a scene. When the condition is true, my scene will turn off the AC. When it does so, the variable tab shows that the ModeTarget switches from CoolOn to Off. I just can’t get the PLEG logical action to do that!
I have attached my status report if anyone has any ideas.

This thread has been quiet for a long time now. But, I just started hacking away at the original request in the latest firmware (Shut off HVAC after 5 minutes of open sensors.)

Does anyone else still have an interest in this? If so, let me know and I can clean up and post my code if others are willing to test.

The turn off HVAC if the door is open for 5 minutes is the reason I bought a Vera 5 years ago. It worked fine with UI5, then my VeraLite died and I replaced it with a VeraEdge running UI7. I cannot get the original plugin to create a device to control the thermostat. My knowledge of lua code is limited.
Any help would be greatly appreciated.

I created a device, however there is no interface that allows me to specify the sensors that control the thermostat. In UI5 you could declare which sensors would trigger the thermostat to turn off. I cant find the inputs for the door sensors.

Any help?

Did you try Reactor?

Not familiar w/ Reactor. Does it cover this kind of situation (IFTT)?

Yes but not thru IFTTT. It is a Vera plugin available under apps. Reactor lets you set up conditions and when the condition or conditions become true or false reactor can respond with an activity that you specify.

Indeed, i also use Reactor to act on a door that is not closed in 60 seconds. I set it up by using these tips:

1 Like

Thank you for the help. I will look into this ASAP.

Ok, ready to try this live and without a net.

Trying to set up turning off the AC if either the living room door or the bedroom door are open. Using an OR condition to check the doors, I only want the AC to come back on if both doors are closed. Should I latch one or both sensors?