Rule Machine Thermostat rule help please


(Joe) #1

I am trying to setup rule machine to do the following with my Nest Thermostat.

  1. If any window is open for more than 5 minutes set thermostat to off
  2. When all windows are closed set the thermostat to the mode it was in previously

The only modes I see for nest are Heat, Cool, and Off. So I can’t just toggle off and on.

I don’t see a way to capture a thermostat mode. I’d also like to do this in one or two rules if possible.

Any advice?


(Matt) #2

Keo,

Try a different approach. When the window is open change heating setpoint to 50 and cooling to 85


(Jason "The Enabler" as deemed so by @Smart) #3

Try this…

Condition - any window open
Rule - any window open
Actions for true - delay 5 minutes, cancellable: set nest to off
Actions for false - set nest mode auto.

I think this is as close as you’re going to get with this one.
I don’t see a way g for the system to know the last state of the device.
I do not have a nest thermostat so I’m not sure how it looks in rule machine.


(Joe) #4

Thanks everyone I found an app under energy management that does exactly what I want. Sometimes a rule isn’t enough I guess.


(Tolik) #5

I have a similar situation. The problem with the thermostat auto off app is that it doesn’t turn it back on when you close the windows.


(Matt) #6

simple rule.

condition
window open

true
thermostat heat 55 cool 85

false
thermostat whatever heat point you use cool same


(Joe) #7

According to the description:

description: “Automatically turn off thermostat when windows/doors open. Turn it back on when everything is closed up.”

However, I’ve noticed it doesn’t seems to turn my nest back on. Is it a problem with nest?


(Tolik) #8

Yup, exactly, the description is garbage. Maybe @tonesto7 can integrate something like this into the Nest Manager SmartApp.


(Joe) #9

Hmmmm… I found this on github
https://raw.githubusercontent.com/smartthings-users/smartapp.hvac-auto-off/master/hvac-auto-off.smartapp.groovy

Seems to be the same account as listed in the app supplied with smartThings. I installed the app and ran it through the simulator. It worked.


(Joe) #10

Hmmmm… If I open and close a contact quickly it seems like the state recorded remains off. I am going to do some more testing to see if I can determine why and maybe supply a fix

If I open the contact, wait for the heat to turn off and then close the contact it works perfectly.


(Anthony S.) #11

That feature is already complete and will be in the next release along with a few other things :smile:


(Tolik) #12

So if you have it set for lets say, five min. delay to turn off the thermostat. It turns it off. Then when you close the window it turns it back on to the the original state?


(Tolik) #13

NICE! Thank you.


(Joe) #14

Yes. If I open the contact and wait for the fan on my furnace to stop then close the contact, the thermostat returns to heat.


(Joe) #15

Taking the code from github and modifying the initialize statement to look like this appears to resolve the problem:

def initialize() {
	state.changed = false
    state.thermostatMode = thermostat.currentValue("thermostatMode")
	subscribe(sensors, 'contact', "sensorChange")
    log.debug "State Info: $state"
}

After installing the app it wasn’t getting the thermostat state until after a successful mode change on the thermostat. I’ll test it a bit more and then send the information to smartThings to see if they can update their app.


(Joe) #16

I have an app that seems to be working well for me. If you add the following repository in smartThings you can give it a try:

Owner: xxKeoxx
Name: green-thermostat
Branch: master

The app will send push notifications when the first window is opened and the thermostat is turned off. Then when closing the window contact you’ll get a push if any windows are left open. The push notification will contain the names of the sensors still open.

If someone turns the thermostat on before all contacts are closed, the thermostat will be turned back off and a push notification will be sent telling you which windows are still open.

Let me know if you have questions.


(Joe) #17

Oops… Spoke too soon. I have bug in the recovery after windows are shut. I’ll let you know when it’s complete.


(Joe) #18

Ok. I think I have all of the bugs worked out. Go ahead and install the app from git hub. You can either do it through smartThings or paste the code from here:


[Solved] Thermostat Auto Off - not turning back on after windows closed?
(Tolik) #19

Just installed it. I looks the same as the “Thermostat Window Check” SmartApp. Is that the base code?


(Joe) #20

Yes. It was the base code but I corrected the issue where it doesn’t set the state back. I also cleaned it up a bit and added a few things.

For instance you can now turn the thermostat on and if any windows are open it will turn off again and let you know which windows are open.
It also checks to see if Windows are open on initializing and turns the thermostat off
Additionally it sends a push notification as you close Windows if all of them haven’t been closed. The notification sends a list of opened Windows.

This was my first attempt at app development in SmartThings, so let me know if you see bugs or room for improvement.