Skip to content

feat(weather): add Bright Sky provider - #4291

Draft
ms-zone-41 wants to merge 2 commits into
MagicMirrorOrg:developfrom
ms-zone-41:feat/brightsky-provider
Draft

ms-zone-41 wants to merge 2 commits into
MagicMirrorOrg:developfrom
ms-zone-41:feat/brightsky-provider

Conversation

@ms-zone-41

@ms-zone-41 ms-zone-41 commented Oct 3, 2026 •

Copy link
Copy Markdown

Note

Draft – please do not review yet. I am still doing my own final review of this change. I will mark this PR as ready for review when it is done.

This PR adds Bright Sky as a server-side provider for the default weather module.

Bright Sky is a free JSON API for the open data of the German Meteorological Service (DWD): station observations and MOSMIX forecasts. It needs no API key and gives very good results for Germany, which so far has no dedicated provider. Locations outside Germany are covered as well, but with fewer stations nearby.

Related issue

No related issue.

Changes

  • New provider brightsky, based on the WeatherProvider base class:
    • current: the latest station observation (/current_weather)
    • hourly: MOSMIX forecast records (/weather), past hours are skipped
    • forecast/daily: the hourly records aggregated into local calendar days (min/max temperature, dominant daytime icon, max wind, precipitation sum, max precipitation probability)
  • Bright Sky records describe the previous hour, so the 00:00 record counts towards the previous day. Today keeps its already elapsed hours, so min/max and precipitation cover the whole day and today is still shown late in the evening.
  • The request URL is built before every fetch (urlFactory), so the date range stays current across midnight.
  • The location name comes from BigDataCloud reverse geocoding, like in the Open-Meteo provider.
  • Second commit: the provider also returns the sunshine duration as sunshineHours (sum of the hourly records per day; for current the sum of today, which needs an extra request and is therefore only loaded with showSunshineHours). It is displayed by the option from feat(weather): add showSunshineHours option #4292. Without feat(weather): add showSunshineHours option #4292 the value is simply not shown, so I can also drop this commit if you prefer.
  • Unit tests for configuration, current weather, hourly and daily forecast (including the midnight and late-evening cases) and error handling.
  • brightsky and MOSMIX are added to the spelling dictionary, and brightsky to the weather release-note labels.

Example configuration:

{
	module: "weather",
	position: "top_right",
	config: {
		weatherProvider: "brightsky",
		type: "forecast",
		lat: 52.52,
		lon: 13.41
	}
}

I will open a PR for the documentation (modules/weather.md) as soon as this one looks fine to you.

Screenshot

Current weather and forecast with live data (the sunshine values are shown with showSunshineHours from #4292):

Bright Sky

Testing

  • npx vitest run tests/unit/modules/default/weather (all weather unit tests pass)
  • node --run test:lint and node --run test:spelling for the changed files
  • Running on my own mirror (Raspberry Pi 4) with current weather, hourly and daily forecast

I used an AI coding assistant to help prepare this change. I reviewed and tested it myself.

Adds a server-side provider for Bright Sky (https://brightsky.dev), a free
JSON API for the open data of the German Meteorological Service (DWD).
It needs no API key and gives very good results for Germany, which so far
has no dedicated provider.

- current: latest station observation (/current_weather)
- hourly: MOSMIX forecast records (/weather)
- forecast/daily: hourly records aggregated into local calendar days.
  Bright Sky records describe the previous hour, so the 00:00 record
  counts towards the previous day. Today keeps its already elapsed hours,
  so min/max and precipitation cover the whole day and today does not
  disappear late in the evening.

Builds on the WeatherProvider base class, uses the shared provider
utilities (SunCalc sun times, km/h -> m/s) and requests the date range
via urlFactory, so it stays current across midnight.
Bright Sky delivers the sunshine duration (in minutes) for every hourly
record. The provider now returns it as sunshineHours:

- forecast/daily: the sum of the records of each day
- current: the sum of today's records (observations so far plus the
  forecast for the rest of the day). This needs an extra request, so it
  is only loaded when showSunshineHours is enabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant