Posted in

Monitoring Temperature Trends with Home Assistant

As I’m writing this, we’re dealing with a heatwave. Every day the question is the same: open the windows to let fresh air in, or keep them closed to hold on to the cool indoor temperature? It sounds simple, but the right answer depends on variables that are hard to judge by feel alone.

Home Assistant has become my go-to tool for making that call. With the right setup, you can track temperatures inside and outside at the same time and see whether they’re rising or falling, not just what they are right now.

Tracking Indoor and Outdoor Temperatures

To do this analysis, I use several integrations together:

  • Netatmo: My Netatmo outdoor module reliably reports the current outside temperature and whether it’s trending up or down.
  • Aqara Temperature Sensors and Tado Thermostats: Inside the house, I monitor temperatures in all rooms using Aqara sensors and Tado thermostats and radiator valves.

Combining these gives a complete picture of the temperature dynamics throughout the house.

The Importance of Trend Analysis

While Netatmo conveniently shows whether the outdoor temperature is increasing or decreasing, the indoor sensors don’t offer this out of the box. Home Assistant’s built-in Trend integration fills that gap: it analyzes whether a sensor value is trending upward or downward over a configurable time window.

Creating Trend Binary Sensors

As a concrete example, here’s how to track the temperature in my office using the entity sensor.office_temperature. The YAML below creates two binary sensors, one for a rising temperature and one for falling:

binary_sensor:
  - platform: trend
    sensors:
      office_temperature_rising:
        entity_id: sensor.office_temperature
        sample_duration: 3600 # 1 hour
        max_samples: 10
        min_gradient: 0.0001389 # ~0.5 °C increase
        device_class: heat
      office_temperature_falling:
        entity_id: sensor.office_temperature
        sample_duration: 3600 # 1 hour
        max_samples: 10
        min_gradient: -0.0001389 # ~0.5 °C decrease
        device_class: cold

This configuration checks over a 60-minute window to see if the temperature has changed by approximately 0.5 °C. Those values are tuned to match how Aqara sensors report updates. Here is the explanation from their official website:

If the temperature, humidity and atmospheric pressure vary only a bit, data will be reported once an hour.
If the temperature variation exceeds 0.5℃ (1℉), the humidity variation exceeds 6% and the atmospheric pressure is no less than 25hPa, data will be reported instantly.

When no significant change is detected, the sensor holds its last value and sends no update, so the trend stays flat. The thresholds of 0.5 °C and 60 minutes are chosen to match that reporting behaviour.

Adding a Temperature Sensor with Trend Icon

To make the trend visible at a glance, I created a template sensor that reuses the original temperature reading but changes the icon dynamically based on the current trend state:

  • Thermometer Plus: Temperature rising (mdi:thermometer-plus)
  • Thermometer Minus: Temperature falling (mdi:thermometer-minus)
  • Thermometer: No significant trend (mdi:thermometer)

Here’s the YAML for the template sensor:

sensor:
  - platform: template
    sensors:
      office_temperature_with_trend:
        device_class: temperature
        value_template: "{{ states('sensor.office_temperature') | default(0) }}"
        icon_template: >
          {% if states('binary_sensor.office_temperature_falling') == "on" %}
            mdi:thermometer-minus
          {% elif states('binary_sensor.office_temperature_rising') == "on" %}
            mdi:thermometer-plus
          {% else %}
            mdi:thermometer
          {% endif %}

Displaying the Sensor in Your Dashboard

Home Assistant dashboard tile showing office temperature with a thermometer trend icon
Office Temperature with Trend indication

Add sensor.office_temperature_with_trend to your Home Assistant dashboard. You’ll see the current temperature alongside an icon that reflects the direction it’s heading, so you can tell at a glance whether a room is warming up or cooling down without digging into history graphs.

Conclusion

The Trend integration is a small but practical addition to any temperature monitoring setup. It turns a simple reading into something actionable: you know not just what the temperature is, but where it’s going. For everyday decisions like whether to open a window, that extra context makes a real difference. Once you have it working for one room, it takes only a few minutes to repeat for every sensor in the house.

Leave a Reply

Your email address will not be published. Required fields are marked *