Energy Saving. It's fresh outside, time to open the windows

Hey there! I’ve got a challenge for you! I’d like to create an automation in Home Assistant that uses two thermometers (one inside and one outside) to determine the best time to open the windows and let fresh air in during hot summer days. To do this, we need to program an automation that detects when the temperature outside starts to decrease at night and becomes cooler than the temperature inside the house. This will be the perfect time to open the windows and let in some fresh air. Similarly, we need to program another automation that detects when the temperature outside begins to rise near dawn. At that point, we should close the windows to keep the coolness inside and save energy. Thank you so much!

This is directly from the documentation:

automation:
  trigger:
    - platform: numeric_state
      entity_id: sensor.outside_temperature
      # Other entity ids can be specified for above and/or below thresholds
      above: sensor.inside_temperature

The threshold helper is useful for this, too. Its hysteresis setting avoids a “floating” situation.

I think this has been asked before. Don’t have time to search right now, but I’m pretty sure it’s out there.

There are other factors to consider, like humidity. I really like this idea, because it’s something I always do manually. Unfortunately I don’t have automated window openers, so it’s sort of moot for me.