Thermostat control based on Door Open Sensors


#1

Updated the source to this original post with the very latest with thankful input and testing from others on this site. I have been using this setup for over two months with multiple renting guests unknowlingly stress testing it and I feel this is very stable and reliable. Make sure to get the poller piston for the thermostat as well.

Love webCore and its capabilities. I am sure this is one of a few similar apps to control my Honeywell Thermostat with two door open sensors. I have tested it with various use cases and it seems to work as expected. I made multiple changes based on these scenarios and seems like we are at least at a usable state. Very likely has room for improvement/simplification. Works with multiple doors, not just two doors.

If one or more doors open, it waits a default of 70 seconds to check if the door(s) are still open and if so, will set the thermostat mode to Off. Once doors close, it will re-enable to the previous saved mode. I probably should add a feature to delay re-enabling from Off to Auto or similar for those units which don’t have built-in delays to avoid stressing the unit.

Also responds to a thermostat mode change in case someone tries to override what we are doing and sets the thermostat mode back to Off.

Hope this helps someone needing same. And look forward to any improvements.


#2

I have a similar set of scripts. I don’t have any safeties built in for someone trying to override the thermostat with a door or window open, that’s a good idea! :slight_smile: I’ll write mine so it plays a text string through the sonos closest to the thermostat speaking which window is open.

The first script is what checks various windows and doors for open status and sets a global variable called in other scripts. Mine is set to five minutes just so I’m not cycling the thermostat on and off for a door left open for just a couple minutes.

Once the house open variable goes to open, the second script shuts off (Ecobee thermostat) the AC or heat; and ceiling fans turn on to circulate the fresh air.
There’s a separate if block to not crank the bedroom fans up to high at night though (e.g. someone in one room opens a window at night, it’ll kill the AC but not start blasting other bedroom fans at high speed)
When the house gets closed back up, it goes back to its last heat/ac setting and temperature.
Finally, It also adjusts the temperature so the furnace/ac doesn’t run as often when we’re not home.



#3

This is exactly what I was looking for when I came on here. I am an original CORE user, and switching to webCoRE today. Is there a way to import your code as a starting point?


#4

I answered my own question… Just had to read more of the Newbie section!

It looks like @dback2004’s import properly, but @dalel2000’s don’t import as he might have shared the private code. Is that correct?


#5

Yes. The red import code will not work for others, and should NEVER be shared publicly.


@dalel2000, for your safety, I removed the private import code in your image above.
Feel free to edit that post with the GREEN import code so others can easily import your piston.


#6

Thanks, still new to this.


#7

@dalel2000 if you’re willing, I’d like to have the import code for yours. It’s exactly what I’ve been looking to do.


#8

Hey. Gladly, I just posted a new update with several clean-up items and more comments.

70fwy


#9

You will also want the thermostat poller which pings the thermostat to update its status more often than a few minutes and checks for any manual overrides of mode to reset to auto or off.

42bek


#10

Latest version posted below. Have also added thermostat poller which checks for override of mode and ensures the thermostat is updating state every 30 seconds. Also added a third routine (which I will combine with the poller) to reset upper and lower limits on temperature.


#11

thanks, still learning this stuff :wink:


#12

nice work. I want an audible alert as well for my guests who wonder why the unit is not working. Ill try to integrate in as an option. Looking for a cheap output speaker that works for my need.


#13

I was about to write a pistol that does exactly this, but I’ll give yours a try first! Thanks for posting this!


#14

Thanks so much! I will take a look at this during the weekend.


#15

@dalel2000 thanks again for posting this… I am not sure if I did something wrong on my import, but the issue I am having is that the if the thermostat in in cool state, door opens, it saves the state, reports that the saved state is cool, then turns off the thermostat, but then the saved state winds up changing to ‘off’. So, when the door closes again, the thermostat is never set back to cool.

Did I do something wrong here on the import?


#16

I found the same thing. It’s due to CurrentMode being defined initially at the top as the thermostat mode.
change that to no value and it will work


#17

I take that back - I did have the same issue and removed the initial definition, and set the CurrentMode just before turning off (forgot to mention in previous reply) and it was working. but I reverted to the original code and it is now working as designed


#18

@michaellubrano @dalel2000

What I found was in my case, the logic where if the thermostat mode is changed, it runs through the routine again. So, it looks like if the door opens, it checks the status, waits, then turns off the HVAC. Then the piston says “Oh wait, the thermostat just changed, so let me check and see if someone is trying to over ride what we’re doing.”

I adjusted the logic to be if the thermostat changes away from off, then run the routine:

That fixed the issue I was seeing.


#19

Just be aware that with this block:

… your piston will run thru the entire code (top to bottom) when any door opens or closes, as well as any time the thermostatMode changes to anything at all.


#20

@WCmore Thanks for the info. I think based on the logic posted above, there are variables set that it checks once either of these 2 occur then runs through the code based on those variables being set.

Do you have a more efficient way of doing this? Happy to learn!