Skip to content

Add weather symbol text and condition mapping for forecasts - #388

Draft
felix-hoc wants to merge 1 commit into
killer0071234:mainfrom
felix-hoc:forecast-symbol-text
Draft

Add weather symbol text and condition mapping for forecasts#388
felix-hoc wants to merge 1 commit into
killer0071234:mainfrom
felix-hoc:forecast-symbol-text

Conversation

@felix-hoc

Copy link
Copy Markdown

What

Adds translation of the forecast weather symbol (sy parameter) into words:

  • zamg.symbols module with the official German descriptions (SYMBOL_TEXT_DE), unofficial English translations (SYMBOL_TEXT_EN) and a mapping to Home Assistant weather condition strings (SYMBOL_CONDITION), plus symbol_to_text() / symbol_to_condition() helpers
  • get_forecast_current() now returns sy_text and condition alongside the raw sy code
  • the trimmed forecast payload from get_forecast() gets derived sy_text and condition parameter series, same pattern as the existing rain and wind_speed
  • README section + tests

Why

The sy code list is not part of the API metadata; the only official source is the (German only) table in Geosphere-Austria/dataset-api-docs#30. Every consumer currently has to copy that table by hand.

This is also groundwork for the Home Assistant zamg integration: the weather entity has no condition property and always shows unknown (home-assistant/core#161571). With condition available from the library, the HA integration can populate the weather entity state and an hourly forecast from get_forecast(). Happy to follow up with that HA core PR after this is released.

Notes

  • GeoSphere provides no official English translations, so SYMBOL_TEXT_EN is a best-effort translation; the official German text is available via symbol_to_text(code, lang="de")
  • Duplicate codes (11–13, 17–18, 20–22, 23–24, 26–27) are mapped to identical texts, matching the official table
  • condition intentionally never returns clear-night — the library does not know the sun position, so the consumer has to swap sunny for clear-night at night (documented in the module)

🤖 Generated with Claude Code

The forecast weather symbol (sy parameter) is only available as a
numeric code and the code list is not part of the API metadata.
Add the official German descriptions, unofficial English translations
and a mapping to Home Assistant weather condition strings, based on
Geosphere-Austria/dataset-api-docs#30

get_forecast_current() now includes sy_text and condition, and the
trimmed forecast payload gets derived sy_text and condition parameter
series alongside the existing rain and wind_speed ones.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@felix-hoc

Copy link
Copy Markdown
Author

@killer0071234 Please let me know if this feature is wanted in general - if so, I am happy to incorporate change requests :)

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