Implement beach_conditions and wind_conditions providers via CatalunyaBeachesAdapter - #70
Merged
Conversation
…talunyaBeachesAdapter - Expand adapters/catalunya_beaches.py to read all related beach entities by deriving the beach prefix from any Catalunya Beaches entity_id - Replace beach_conditions scaffold with real provider: collects water quality, temperature, jellyfish status, UV index, lifeguard presence; emits alerts for jellyfish (warning), poor/very-poor water quality (warning/critical), and out-of-season (info) - Replace wind_conditions scaffold with real provider: collects wind speed, wave height, sky condition, air temperature; emits alerts for elevated/ dangerous wind (warning/critical) and rough/dangerous waves (warning/critical) - Neither provider inherits StubBriefingProvider logic for normalize(); both implement get_adapter() and normalize() with real data - Add 14 new provider tests covering normalization, alert emission, error handling, and dashboard fragments - Update test_provider_schemas to reflect that beach/wind now support alerts - Update docs/setup.md with prerequisites for beach/wind snippets - Update TODO.md and AGENTS.md to mark issue #55 complete Closes #55
Copilot
AI
changed the title
[WIP] Implement beach_conditions and wind_conditions providers
Implement beach_conditions and wind_conditions providers via CatalunyaBeachesAdapter
Jul 2, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR replaces the previously scaffolded beach_conditions and wind_conditions providers with real implementations backed by a new CatalunyaBeachesAdapter, enabling adapter-based multi-entity beach snapshots (including alert emission) and adding tests/docs to support the new functionality.
Changes:
- Implemented
CatalunyaBeachesAdapterto derive a beach prefix from a chosen entity and fetch a structured set of related sensor/binary_sensor states. - Implemented real
BeachConditionsProviderandWindConditionsProviderwith human-readable summaries, alert thresholds, and dashboard fragments. - Added/updated tests and documentation to reflect the new providers and their prerequisites.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| TODO.md | Marks the beach/wind provider task as completed. |
| custom_components/user_briefing/adapters/catalunya_beaches.py | Replaces adapter stub with multi-entity fetch logic and prefix extraction. |
| custom_components/user_briefing/providers/beach_conditions.py | Implements beach conditions summary + alert emission via CatalunyaBeachesAdapter. |
| custom_components/user_briefing/providers/wind_conditions.py | Implements wind/sea conditions summary + alert emission via CatalunyaBeachesAdapter. |
| tests/test_providers.py | Adds provider-level tests for beach/wind normalization and alert thresholds. |
| tests/test_provider_schemas.py | Updates schema expectations to reflect beach/wind now supporting alerts. |
| docs/setup.md | Documents the ha-catalunya-beaches prerequisite and how source entity selection works. |
| AGENTS.md | Updates project status/docs to reflect beach/wind providers are no longer stubbed. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…rs and update docstring/docs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both
beach_conditionsandwind_conditionsproviders were scaffold stubs inheritingStubBriefingProviderand returning placeholder text. This replaces them with real implementations backed by theha-catalunya-beachesHACS integration.Adapter (
adapters/catalunya_beaches.py)Expanded from a 2-line stub to a full multi-entity reader. Accepts any Catalunya Beaches entity as
source_ref, extracts the beach name prefix by stripping known suffixes, then reads all 10 sensor and 5 binary sensor entities in a single fetch:providers/beach_conditions.pywarning; water qualityPoor→warning,Very Poor→critical; water quality binary off (fallback) →warning; out of season →infoout_of_seasonscenario when beach is closed for the seasonproviders/wind_conditions.pywarning, ≥ 60 km/h →critical; waves ≥ 1.5 m →warning, ≥ 2.5 m →criticalTests
14 new tests in
test_providers.pycovering normalization, alert emission for each threshold, error/unavailable handling, and dashboard fragment structure.test_provider_schemas.pyupdated to reflect that both providers now havesupports_alerts = True(onlyhome_statusremains a stub with alerts off).Docs
docs/setup.mddocuments theha-catalunya-beachesprerequisite and explains how prefix derivation works so users know they can pick any beach entity as the source.