It's so hot in here. Notification when to close and open windows/doors

I would like to get notifications when it’s time to close windows/doors when the outside temperature is higher outside than my home temperature. I got the inspiration from the latest HA release example code, pasted below. But i would like to extend/improve the automation so that i also get a notification when the outside temperature later in the evening gets lower than our inside temperature.
This should only be triggered if the previous notification has been sent. If i get this automation in place, i will know when to close the windows/doors in the morning to isolate the inside temperature and also later know when to open the windows/doors in the same evening to let the colder outside temperature in to our house.
How would be the best way to achieve this?

automation:
  - alias: "Notify to close the window"
    trigger:
      - platform: numeric_state
        entity_id: sensor.outside_temperature
        above: sensor.inside_temperature
    action:
      - service: notify.frenck_iphone
        data:
          message: "Close all windows, it is warm outside!"
1 Like

That’s topic of my video for next week (already recorded). :joy:
Check this here:

- id: '1625993573809'
  alias: Warmer outside
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.balcony_temperaturee
    above: sensor.living_room_temperature
  condition:
  - condition: numeric_state
    entity_id: sensor.living_room_temperature
    above: '24'
  action:
  - service: notify.syno_chat
    data:
      message: Please close the windows, inside temperature is {{ states("sensor.living_room_temperature")
        }}°C, {{states("sensor.living_room_temperature")|int - states("sensor.balcony_temperature")|int}}°
        cooler than outside.
  mode: single
- id: '1625993956093'
  alias: Cooler outside
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.balcony_temperature
    below: sensor.living_room_temperature
  condition:
  - condition: numeric_state
    entity_id: sensor.living_room_temperature
    above: '24'
  action:
  - service: notify.syno_chat
    data:
      message: Open windows - inside temperature is {{ states("sensor.living_room_temperature")
        }}°C, {{states("sensor.living_room_temperature")|int - states("sensor.balcony_temperature")|int}}°
        hotter than outside.

I didn’t cover if the notification has been sent or not, but one way of doing it is to set helpers (input_boolean) and then also check in condition state of it, but this really ads to complexity as you also have to control state of it.

My recommendation is to use time for this - for ex just add under above: and below:

 for:
   minutes: 15

This would wait for this state to really be “true” and not just little temperature fluctuation. You can of course extend that time to 30 or even 45 minutes (but use that only for open window, on close, keep it as short as possible).

2 Likes

I love this type of idea! In spring and fall I already do this manually. It’s great to be able to retain the (lower) inside temperatures during the heat of the day. My house is well insulated and will hold temperature for quite a while.

I should add that it works the other way too, when the nights get too cold and the windows need to be closed at night but can be open during the day. Weather factors like rain, humidity and sunlight can also be factored in.

It all gets pretty complicated, and in my climate there really aren’t all that many days when this is important. My ideal home would have automated windows, shades and fans which take full advantage of outside conditions and the thermal mass of the house whenever possible. But that’s a long way off.

Meanwhile, I’m going to play around with this solution. Thanks for posting!!

1 Like

This summer, and “3rd heat wave and July just started” made me buy some external temperature sensors and work on this automation.

Not to mention that buying Zigbee indoor use only sensors, made me look for a way to get them out, protect from direct sunlight but also future weather elements such as rain - Stevenson screen for Xiaomi Aqara Temperature, Humidity and Pressure sensor (WSDCGQ11LM) & Sonoff SNZB-02 by traviz - Thingiverse

I would include in this additional condition - to be active only in summer, but we had one heat wave in spring - so maybe using condition “if not winter” could work too. A lot of things can be added on this.

Agreed. When you consider all the variables that drive the decision to open or close windows, the resulting automation(s) can get quite complicated.

For example, the two suggested automations posted by BeardedConti can be distilled into this single version:

Click to reveal automation
- alias: 'Monitor indoor-outdoor temperature difference'
  trigger:
  - platform: numeric_state
    entity_id: sensor.outdoor
    above: sensor.indoor
    for: '00:03:00'
    id: 'close'
  - platform: numeric_state
    entity_id: sensor.outdoor
    below: sensor.indoor
    for: '00:03:00'
    id: 'open'
  condition: "{{ states('sensor.indoor') | int > 24 }}"
  action:
  - service: notify.whatever
    data:
      message: "Please {{ trigger.id }} the windows, it is {{ 'warmer' if trigger.id == 'close' else 'cooler' }} outside."

So what else should this seemingly straightforward automation also consider?

  • Indoor temperature changes
    It only monitors changes to outdoor temperature. If outdoor temperature is warm but fairly stable, over time indoor temperature will rise. However, it won’t trigger the automation because there’s no trigger for indoor temperature.

  • HVAC system
    It doesn’t consider the current setting and activity of the HVAC system. If the house is being heated, the indoor temperature might exceed the 24 degree threshold (not in my home but maybe in a household with young or elderly occupants) and then the automation will request that you open windows in the dead of winter.

  • Occupancy
    It excludes the state of the home’s occupancy (and/or state of the alarm system). It will request opening/closing windows while no one is home or the house is armed_home (or armed_away).

  • Quiet times
    It has no time fences so may send notifications in the dead of night.

There are probably other factors to consider as well but the point is that, like you said, “it all gets pretty complicated”. An automation that doesn’t handle the listed factors is liable to make ill-considered suggestions and become more of a nuisance than an aid.

Nevertheless, it’s a reasonable starting point but should be considered just that, only a starting point.

2 Likes

And on this you can add choose in actions to trigger different actions based on trigger IDs with additional conditions (for ex. don’t do anything if middle of the night/mute notification), other condition could be wind speed,…

So by using the same Trigger ID with further conditions create more complex actions.

What comes to mind is if it’s raining outside. Even then it’s not always necessary to close windows; the decision to close windows based on inclement weather is a complex one.

1 Like