Upgrading The Thermostat Bot

The temperature bot a.k.a. the algorithm that controls the temperature in my house underwent a slight upgrade this week.

thermostatbot

The old algorithm:

If (setTemperature > averageHouseTemperature) HEAT, otherwise COOL.

Simple right? Not so much.

Scenario 1:

Let’s say I set the temperature to 70, and it’s currently 71 in the house. According to the bot, the AC would go on, this would be fine if it was 80 degrees outside but not if it’s 55. I’d rather just open the windows, and furthermore, I want it to just stay off until I close the windows.

Scenario 2:

Let’s say I set the temperature to 72, and it’s currently 70 in the house. According to the Bot, the HEAT would go on, this would be fine if it was 55 degrees outside, but not if it’s 80. I’d rather just let it heat up naturally, then if it gets above 72, I want it the AC to come on.

Let’s look at these scenarios in more detail.

In Scenario 1, the set temp is LOWER than the average house temperature, rather than the AC turning on, I want to open the windows and I want the HEAT/AC to stay OFF.

In Scenario 2, the set temp is HIGHER than the average house temperature, rather than the HEAT turning on, I want the house to just heat up naturally but I want AC to kick on if it gets too HOT.

The new LOGIC.

return (outdoorTemp < 62 || outdoorTemp < 67 && setTemp > indoorTemp) 
   ? 'heat' : 'cool';

The final piece of the puzzle is I need to call this on an interval since the indoor and outdoor temperature will fluctuate throughout the day.

(Updated 4/18/2018)

Scroll to Top