Skip to content

PrimePoobah/HomeAssistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HomeAssistant

🌡️ Weather Extremes Tracker for Home Assistant

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.

Features

📊 Comprehensive Tracking

  • Track high and low values across multiple time periods:
    • Daily extremes
    • Weekly extremes
    • Monthly extremes
    • Yearly extremes
    • All-time records

📈 Advanced Analytics

  • Rolling averages with configurable time windows
  • Period-based averages (daily, weekly, monthly, yearly)
  • Exact timestamps for all extreme values
  • Configurable decimal precision

💾 Data Management

  • Persistent storage across restarts
  • Data import/export capabilities
  • Backup and restore functionality
  • Historical data purging options

⚙️ Flexible Configuration

  • Track any numeric sensor
  • Customizable averaging windows
  • Multiple data merge strategies
  • Configurable update intervals

Installation

HACS (Preferred)

  1. Open HACS in your Home Assistant instance
  2. Click on "Integrations"
  3. Click the three dots in the top right
  4. Select "Custom repositories"
  5. Add this repository URL and select "Integration" as the category
  6. Click "Add"
  7. Search for "Weather Extremes Tracker"
  8. Click Install
  9. Restart Home Assistant

Manual Installation

  1. Download the latest release
  2. Copy the weather_extremes folder to your custom_components directory
  3. Restart Home Assistant

Configuration

Basic Configuration

# configuration.yaml
sensor:
  - platform: weather_extremes
    sensors:
      - entity_id: sensor.outdoor_temperature
        name: Outdoor Temperature
        unit_of_measurement: °C

Advanced Configuration

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

Configuration Options

Option Type Default Description
persistence boolean true Enable/disable data persistence
sensors list Required List of sensors to track

Sensor Options

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)

Generated Entities

For each configured sensor, the following entities are created:

Extremes

  • 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

Averages

  • 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

Services

Core Services

  • weather_extremes.reset_period: Reset extremes for a specific period
  • weather_extremes.clear_history: Clear historical data
  • weather_extremes.update_extremes: Manually update values
  • weather_extremes.export_data: Export data to JSON/CSV
  • weather_extremes.import_data: Import historical data
  • weather_extremes.update_averaging_window: Update averaging settings
  • weather_extremes.purge_old_data: Remove old data

Data Management

  • weather_extremes.backup_data: Create complete backup
  • weather_extremes.restore_data: Restore from backup

Example Automations

Record Temperature Alert

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') }}

Daily Weather Summary

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

Lovelace Examples

Basic Card

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

Advanced Statistics Card

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

Contributing

We welcome contributions! Please read our Contributing Guidelines before submitting pull requests.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Authors

  • Original Author: @PrimePoobah

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages