Thermostat and variables


#1

Someone asked for help creating a piston that when triggered, records the current setpoint of the thermostat and sets it to a new temperature. Then when another trigger happens it restores the temperature saved in the variable. I’ve tried making a simple Piston to create thus because I love this idea. I made a Piston that when a switch turns on it saves the current cooling setpoint to local state and sets a new setpoint. Then when the switch turns off I would like it to restore the setpoint but I’m getting an error. It says can not find command to set cooling setpoint to whatever my temperature was. It says the number and it’s correct but it won’t set it.

Is thus actually possible to do? I would love to start involving this in my pistons.


#2

I too am interested in this feature. I am using nest thermostats and when an event triggers I would like to set a set temperature and then when the even ends I would like the thermostat cool point set back to whatever it was set to before. (whether it was manually set or by a predetermined routine.)


#3

Would really help if you filled out the template instead of deleting it.

Did you set the variable type to integer instead of dynamic?


#4

I did try both types of integer and still didn’t work.


#5

I figured it out thanks. Here’s 2 examples.


#6

@coodem, FYI- someone in a facebook group just pointed out that the SmartApp NST Manager can do this natively. I looked at it though- it’s a pretty heavy smartapp that will take some effort to fully figure out all it can do.


#7

Does nst manager work with any thermostat?


#8

I don’t think so, but your piston will! :wink:


#9

Good examples - they helped me clean up my code a good bit. I did something similar with more devices and found the capture/restore attributes much easier to use. Here it is in case it helps anyone else.


#10

Eric,


I found your piston which is exactly what I’ve been looking for but I can’t get the delay to work. When I open my door, it turns off my system instantly. What am I doing wrong?
Thanks!


#11

This is an interesting piston. For one thing, if this is the only piston doing this check, then it won’t turn the system back on until the first part has run anyways. If it shuts down the AC on Monday, there’s no real way for it to turn it back on for Tuesday. You might need a separate piston for that. I’m not entirely sure why it’s turning off immediately, save for the possibility that line 30 is a condition, rather than a trigger. This piston is going to need a lot of rewriting.

I’ll chew on it for a bit, and maybe others will chime in as well. I think the default needs to be that the system will run unless a window has been open for 10 minutes. You might need to get rid of the delay.

Also, instead of exactly 10 minutes, I would change it to greater than 10 minutes, to account for 11, 12, 13, etc. Otherwise, ST might miss it.

Lastly, you’re checking three situations: 1) Are the AC modes on?, 2) Are contacts open/closed, and 3) is disable_active true or false. I get what you’re trying to do, but this is very complicated.

Question: Do you expect your thermostat to always be on unless a window has been open for 10 minutes? Or are there times when you manually turn it off?


#12

Maybe something like this?