Hi everyone, I’m excited to share my recent project with you! I recently set up an integration in Home Assistant to alert me about aurora borealis activity. Since I live at 60°N, I experience long summer days and frequent cloud cover, which makes spotting the auroras a bit tricky. To improve my chances, I decided to create a formula that factors in both cloud cover and darkness levels.
Here’s what I came up with:
- Aurora Chance: This is based on the KP index and geomagnetic activity.
- Cloud Coverage: Using OpenWeatherMap data to account for cloudiness.
- Sky Clarity: Calculated as 1 minus cloud coverage.
- Darkness: Ensuring the sun is at least 6° below the horizon.
I combined these factors into a template that calculates the overall chance of a visible aurora. Here’s how it looks:
python
{% set auroraChance = states(‘sensor.aurora_60_1’)|int/100 %}
{% set cloudCoverage = (states(‘sensor.openweathermap_cloud_coverage’)|int/100) %}
{% set skyClarity = 1-(states(‘sensor.openweathermap_cloud_coverage’)|int/100) %}
{% set darkness = max(0,min(1,1-(state_attr(‘sun.sun’,‘elevation’)+6)/6)) %}
Aurora Chance: {{ (auroraChance * 100)|round(0) }}%
Cloud Coverage: {{ (cloudCoverage * 100)|round(0)}}%
Sky Clarity: {{ (skyClarity100)|round(0) }}%
Darkness: {{ (darkness100)|round(0) }}%
Chance = {{ (auroraChance * skyClarity * darkness * 100)|round(0) }}%
Currently, the output is showing a 0% chance, which makes sense given the time of year and cloud conditions. My goal is to set up notifications that alert me when the chance exceeds a certain threshold, maybe even waking me up if the probability is high enough!
I’m curious if this approach makes sense to others. Have you tried something similar? Any suggestions for improving the formula or implementation would be greatly appreciated. I’m really looking forward to hearing your thoughts and hopefully getting some tips to refine this setup!
Cheers,
Steve