Hysteresis - how to? Controlling motorized windows/blinds for room temperature control

I’m thinking about the following automation:

Our master bedroom is just below the roof, and it’s quite warm in the summer. We got A/C but my wife doesn’t like it …

So there are only windows and blinds to control the temperature. Windows on three corners of the roof are motorized so can be remote controlled, as well as blinds. A light sensor is planned on the west-facing side (afternoon to sunset). No windows on the east-facing side. A temperature sensor is already installed.

In the morning all blinds would open, and as well the windows (if they are not opened still).

It’s a hot summer day, temperatures rise, and so the blinds will be closed if it’s a sunny day. Windows will close as well as soon as outside temperature is above inside.

During the days everything should stay closed, or maybe one/two/three windows could be opened. If this lowers the temperature fine. Keep it. It temperature raises, close them again.

In the evening (or just all over the day) the windows should open to let cool air flow through as soon as the temperature outside is lower than inside.

But how would I make sure that the windows don’t open/close all the time as inside and outside temperatures are maybe very similar and sensors may give slightly wrong values?!

You can set an input_number with data_template and {{as_timestamp(now())}}.
Then use a template condition, like

{{(states('input_number.last_change') | int + 300) < as_timestamp(now())}}
1 Like

Hmmm. Let me try to understand. It takes something (last change) makes an integer out of it and adds 300, then compares it to current time, correct?

But was IS the input_number.last_change from?

Basically you have a service call when it successfully runs, that sets an input_number with

value: '{{as_timestamp(now())}}'

Then you also have a condition. Breakdown:

states('input_number.last_change') | int

Gets the last change and turns it into an int (from a string)

+ 300

5 minutes later

Also I had a typo, this is correct:

{{(states('input_number.last_change') | int + 300) < as_timestamp(now())}}

Perfect. Thanks for taking the time to explain that to me! :slight_smile:

I’m thinking for the same since years.
take care of some points:
-what about somes sunny summer day.
-what about if a sensor is wrong (inside or outside. I’m using onewire every user of this tech knows about 85°C).
My house and windows are east west following sunny elevation to close shutter when sun is to bright in summer is the hardest part for me.

If you find a nice working automation, I really want you to shared it here to make me win a lot of time.