Tracking daily weather extremes in Home Assistant can be a really useful addition to your dashboard, especially if you’re keen to understand trends over time or highlight key information visually.

In my case, I wanted a lightweight, efficient way to display the maximum temperature, minimum temperature, and maximum wind speed recorded during the day. Not only does this create a simple historical snapshot, but it also enables me to power Mushroom Template Cards with rich attribute data, without needing to rely on external integrations or long-term statistics.
The Template Sensor
Here’s the YAML I used to create a template sensor
that records today’s key weather stats. This sensor uses a combination of state and time-based triggers to reset at midnight and accumulate data throughout the day.
- trigger:
- platform: state
entity_id:
- sensor.tempest_temperature
- sensor.tempest_wind_speed
- platform: time
at: "00:00:00"
sensor:
- name: 'Today Weather Statistics'
unique_id: today_weather_statistics
state: "OK"
attributes:
max_temp: >
{% set t_new = states('sensor.tempest_temperature') | float(-99) %}
{% set prev = this.attributes.max_temp | float(-99) %}
{{ [t_new, prev] | max if trigger.platform != 'time' else t_new }}
min_temp: >
{% set t_new = states('sensor.tempest_temperature') | float(99) %}
{% set prev = this.attributes.min_temp | float(99) %}
{{ [t_new, prev] | min if trigger.platform != 'time' else t_new }}
max_wind: >
{% set w_new = states('sensor.tempest_wind_speed') | float(-1) %}
{% set prev = this.attributes.max_wind | float(-1) %}
{{ [w_new, prev] | max if trigger.platform != 'time' else w_new }}
How it works
- State triggers respond to changes in
sensor.tempest_temperature
andsensor.tempest_wind_speed
. Every time they update, the template checks if the new value exceeds (or undercuts) the previous attribute value and stores the result. - Midnight reset is achieved via a time-based trigger at
00:00:00
. At this point, the values reset to the current readings (effectively seeding the day). - The
state
is set to"OK"
as a placeholder—it’s not used for charting or display, but helps avoid null states.
Home Assistant issues with adding new attributes
I found (randomly it seems not predictably) that some of the new attributes would not be created on their first load, once I restarted Home Assistant. It was very frustrating to debug, the logic is to set a variable from a entity state, or otherwise set a float – but something is failing. If you too are finding that the attribute isnt appearing, instead – establish the attribute more simply with a default value. Restart HA and confirm the attribute now shows up. E.g.
max_wind: >
{{ float(0) }}
This creates the new max_wind
attribute with a default value of 0.0
. Now update your YAML per the above with the logic to capture the maximum wind speed, this time it should update without issue.
Using This Sensor in Mushroom Cards
Now that the max and min values are stored in the attributes, you can easily access them in mushroom-template-card
components. Here’s an example that shows the max temperature for today:
- type: custom:mushroom-template-card
primary: "Max Temp"
secondary: >
{{ state_attr('sensor.today_weather_statistics', 'max_temp') | round(1) }}°C
icon: mdi:thermometer-high
Or for minimum temperature:
- type: custom:mushroom-template-card
primary: "Min Temp"
secondary: >
{{ state_attr('sensor.today_weather_statistics', 'min_temp') | round(1) }}°C
icon: mdi:thermometer-low
And similarly for wind:
- type: custom:mushroom-template-card
primary: "Max Wind"
secondary: >
{{ state_attr('sensor.today_weather_statistics', 'max_wind') | round(1) }} mph
icon: mdi:weather-windy
Why I Like This Approach
- It’s simple and fast. No need to use mulitple sensors or long-term statistics.
- It works entirely in real-time, using native templating.
- It powers lightweight dashboard cards with just the information I want to see.
- It’s resettable and predictable – every day starts clean at midnight.