Skip to content

droidgren/smhi_season

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

146 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hacs_badge Validate

icon

Meteorologisk Årstid for Home Assistant

A custom integration that calculates the meteorological season based on SMHI (Swedish Meteorological and Hydrological Institute) definitions.

bruck

Features

  • Calculates daily average temperature automatically.
  • Tracks consecutive days to determine season changes.
  • Follows strict SMHI date and temperature rules:
    • Vinter: ≤ 0.0°C (5 days)
    • Vår: > 0.0°C (7 days, earliest Feb 15)
    • Sommar: ≥ 10.0°C (5 days)
    • Höst: < 10.0°C (5 days, earliest Aug 1)
    • All temperatures are daily averages
  • Sensor 1: sensor.meteorologisk_arstid (Shows current season, progress count, and arrival dates for current cycle).
  • Sensor 2: sensor.meteorologisk_arstid_historisk (Shows arrival dates for the previous cycle).
  • Sensor 3: sensor.meteorologisk_arstid_logg (Show last update)
  • Available in Swedish and English Language.

Installation

HACS (Recommended)

  1. Ensure HACS is installed.
  2. Go to HACS -> Integrations.
  3. Click + Explore & Download Repositories.
  4. Search for "Meteorologisk årstid".
  5. Click Download.
  6. Restart Home Assistant.

Manual

  1. Copy the custom_components/smhi_season folder to your HA custom_components directory.
  2. Restart Home Assistant.

Configuration

  1. Go to Settings -> Devices & Services.
  2. Click Add Integration.
  3. Search for "Meteorologisk årstid".
  4. Select your outdoor temperature sensor (e.g., sensor.outdoor_temperature).

Attributes

The main sensor provides:

  • Ankomstdatum: Date the current season started.
  • Dagar sedan frost: Number of days since the last frost (daily minimum temperature ≤ 0°C).
  • Vinterdygn 0/5: Progress towards Winter.
  • Vårdygn 0/7: Progress towards Spring.
  • Sommardygn 0/5: Progress towards Summer.
  • Höstdygn 0/5: Progress towards Autumn.
  • Förra dygnets medeltemp: The calculated average used for the logic.

Note: After a season is confirmed (e.g., Spring at 7/7), the counter continues to increment as long as the criteria are met (8/7, 9/7, …). This shows the total number of consecutive days that qualify for the current season. The counter resets to 0 only when a day no longer meets the season's criteria.

Screenhots

Sensor

Debug Entities

For testing and simulation, you can enable Debug Entities through the integration's configuration choices (Options). When enabled, three new entities are provided:

  1. Debug Date: Lets you manually set a mock date.
  2. Debug Temp: Lets you manually set the daily average temperature for simulation.
  3. Debug Step Day (Button): Pressing this button will process the mock date and temperature as if the day has just ended.

This makes it easy to simulate consecutive days of specific temperatures and quickly verify season transitions.

Changelog

See the full history in CHANGELOG.md.

1.36

  • Added: Debug entities for simulating days and temperatures to test season transitions manually.
  • Fixed: Resolves issue #11.

Disclaimer

This project is an independent custom integration and is not affiliated with, endorsed by, or connected to SMHI (Swedish Meteorological and Hydrological Institute) in any way. It simply uses their public meteorological definitions to calculate seasons.

About

A custom integration that calculates meteorological season in Sweden.

Topics

Resources

Stars

6 stars

Watchers

2 watching

Forks

Contributors

Languages