HVAC automation behemoth. Can this be simplified?


#1

1) Give a description of the problem
My Heat and A/C automation piston is working quite well, but I have been adding functionality to it and it has gotten a bit difficult to maintain.

2) What is the expected behavior?
I have a couple of pistons that work together to control my two thermostats based on the local outside temperature, if windows are open, time, presence, and soon I will add modes.

3) What is happening/not happening?
I am not a programmer by training but I think that there must be a better way to code this than what I have done. I suspect that I need to add some loops to eliminate a lot of the duplicated code but I am not familiar with their use.

4) Post a Green Snapshot of the piston
Here are the two pistons that are currently running the heat and A/C automation in my home. Any suggestions on ways to make them better would be greatly appreciated.

5) Attach any logs (From ST IDE and by turning logging level to Full)
Piston seems to be too big to allow logs to be created


#2

I decided to split it into 2 separate pistons. One for each thermostat. I kept the Manual Set piston unchanged.

Here is one of my new thermostat pistons. They are both the same just reference different thermostats and have different time and temp settings at the top. I’m sure that I’m still doing some things wrong and would love any suggestions. But it is lot easier to read and manage now at least.


#3

piston looks cool, what does it do?


#4

It automates the heat and cool based on time, mode, and outside temperature. It will not turn the heat or cooling on if the outside temp is between 65-70F. If the outside temp is not in that range (either higher or lower) it will turn off the furnace or A/C and send a notification of which window is open.

I also have another piston that works with this one that allows me to track if anyone manually changes the temp on the thermostat. It sets a timer and resumes the automatic setting after 1 hour.