# Node-red + temp/motion sensors = super smart thermostat?

I’m looking for examples of flows that grab the average temperature from any temp sensor that has detected motion in the last x minutes. Then I want the thermostat set point to change dynamically using that information.

Anyone come across any examples like this?

1 Like

I do something similar to this.

I don’t use Node-Red, but, that doesn’t really matter much.

I calculate the mean (average) temperature for all occupied rooms in my home. “Occupied” is determined by several things, one of which is motion in that room in the last X seconds. If you wanted to trigger simply on motion, you certainly could.

Any time the Thermostat detected temperature changes, or the “occupied” status of any room changes, I recalculate the Thermostat set point. For a “cooling” device, I make the set point 2 degrees below the currently detected temperature when I want it to be “on” and 2 degrees above the currently detected temperature when I want it to be “off”. For a “heating” device, it’s exactly the opposite.

This allows me to indicate that I want my living room to be 72 degrees when occupied, my bedroom to be 75 degrees during the day and 70 degrees at night, and my kitchen to be 73 degrees regardless of if its occupied or not.

Because each of these rules are very specific to each home, there’s no easy way to write an automation that would work for everyone. Instead, I have separate logical climate controllers for each room, they each turn a switch on or off depending on if they want cooling/heating or not, and then a master automation that reads all the switches and determines the setpoint.

It works very well, and even has additional logic built in for changing the set point based on how far away from home I am in order to make sure the house is heated/cooled when I get here, as well as making sure that even if I’m thousands of miles away, my house never goes above or below a certain temperature.