Track temperature and weather extremes over multiple time periods in Home Assistant. This custom component records high and low values for any sensor across daily, weekly, monthly, yearly, and all-time periods.
- Track high and low values across multiple time periods:
- Daily extremes
- Weekly extremes
- Monthly extremes
- Yearly extremes
- All-time records
- Rolling averages with configurable time windows
- Period-based averages (daily, weekly, monthly, yearly)
- Exact timestamps for all extreme values
- Configurable decimal precision
- Persistent storage across restarts
- Data import/export capabilities
- Backup and restore functionality
- Historical data purging options
- Track any numeric sensor
- Customizable averaging windows
- Multiple data merge strategies
- Configurable update intervals
- Open HACS in your Home Assistant instance
- Click on "Integrations"
- Click the three dots in the top right
- Select "Custom repositories"
- Add this repository URL and select "Integration" as the category
- Click "Add"
- Search for "Weather Extremes Tracker"
- Click Install
- Restart Home Assistant
- Download the latest release
- Copy the
weather_extremes
folder to yourcustom_components
directory - Restart Home Assistant
# configuration.yaml
sensor:
- platform: weather_extremes
sensors:
- entity_id: sensor.outdoor_temperature
name: Outdoor Temperature
unit_of_measurement: °C
sensor:
- platform: weather_extremes
persistence: true
sensors:
- entity_id: sensor.outdoor_temperature
name: Outdoor Temperature
unit_of_measurement: °C
averaging_window: 15
decimal_places: 1
- entity_id: sensor.wind_speed
name: Wind Speed
unit_of_measurement: km/h
averaging_window: 5
decimal_places: 0
- entity_id: sensor.rainfall
name: Rainfall
unit_of_measurement: mm
averaging_window: 30
decimal_places: 2
Option | Type | Default | Description |
---|---|---|---|
persistence |
boolean | true |
Enable/disable data persistence |
sensors |
list | Required | List of sensors to track |
Option | Type | Default | Description |
---|---|---|---|
entity_id |
string | Required | Entity ID to track |
name |
string | Required | Display name |
unit_of_measurement |
string | Optional | Unit of measurement |
averaging_window |
integer | 5 | Minutes for rolling average (1-60) |
decimal_places |
integer | 1 | Decimal precision (0-3) |
For each configured sensor, the following entities are created:
sensor.weather_extremes_[name]_day_high
sensor.weather_extremes_[name]_day_low
sensor.weather_extremes_[name]_week_high
sensor.weather_extremes_[name]_week_low
sensor.weather_extremes_[name]_month_high
sensor.weather_extremes_[name]_month_low
sensor.weather_extremes_[name]_year_high
sensor.weather_extremes_[name]_year_low
sensor.weather_extremes_[name]_all_time_high
sensor.weather_extremes_[name]_all_time_low
sensor.weather_extremes_[name]_current_average
sensor.weather_extremes_[name]_day_average
sensor.weather_extremes_[name]_week_average
sensor.weather_extremes_[name]_month_average
sensor.weather_extremes_[name]_year_average
weather_extremes.reset_period
: Reset extremes for a specific periodweather_extremes.clear_history
: Clear historical dataweather_extremes.update_extremes
: Manually update valuesweather_extremes.export_data
: Export data to JSON/CSVweather_extremes.import_data
: Import historical dataweather_extremes.update_averaging_window
: Update averaging settingsweather_extremes.purge_old_data
: Remove old data
weather_extremes.backup_data
: Create complete backupweather_extremes.restore_data
: Restore from backup
automation:
- alias: "New Temperature Record"
trigger:
- platform: state
entity_id: sensor.weather_extremes_outdoor_temperature_all_time_high
action:
- service: notify.mobile_app
data:
title: "New Temperature Record!"
message: >
New all-time high: {{ states('sensor.weather_extremes_outdoor_temperature_all_time_high') }}°C
Recorded at: {{ state_attr('sensor.weather_extremes_outdoor_temperature_all_time_high', 'timestamp') }}
automation:
- alias: "Daily Weather Summary"
trigger:
- platform: time
at: "23:59:00"
action:
- service: notify.mobile_app
data:
title: "Daily Weather Summary"
message: >
Today's Temperature:
High: {{ states('sensor.weather_extremes_outdoor_temperature_day_high') }}°C
Low: {{ states('sensor.weather_extremes_outdoor_temperature_day_low') }}°C
Average: {{ states('sensor.weather_extremes_outdoor_temperature_day_average') }}°C
type: entities
entities:
- entity: sensor.weather_extremes_outdoor_temperature_day_high
- entity: sensor.weather_extremes_outdoor_temperature_day_low
- entity: sensor.weather_extremes_outdoor_temperature_day_average
title: Today's Temperature
type: custom:apex-chart-card
header:
title: Temperature History
show: true
series:
- entity: sensor.weather_extremes_outdoor_temperature_day_high
type: line
name: High
- entity: sensor.weather_extremes_outdoor_temperature_day_low
type: line
name: Low
- entity: sensor.weather_extremes_outdoor_temperature_day_average
type: line
name: Average
We welcome contributions! Please read our Contributing Guidelines before submitting pull requests.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
- Original Author: @PrimePoobah