Add Met Office Weather Warnings integration#165602
Add Met Office Weather Warnings integration#165602ianByrne wants to merge 6 commits intohome-assistant:devfrom
Conversation
Add a new integration that fetches weather warnings from the Met Office RSS feed for UK regions. Includes a shared brand entry to group with the existing metoffice integration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new metoffice_warnings integration to Home Assistant core to fetch and expose UK Met Office weather warnings (via RSS) as a timestamp sensor, and groups it under a shared Met Office brand alongside the existing metoffice integration.
Changes:
- New integration implementation: config flow (region selector), coordinator (RSS fetch/parse), and sensor entity (timestamp + warnings attributes).
- New test suite with RSS fixture XML files covering normal, empty, invalid, and edge-case parsing.
- Brand grouping + generated file updates (brands entry, generated config flows/integrations, quality scale registration, CODEOWNERS, and codespell ignore update).
Reviewed changes
Copilot reviewed 25 out of 27 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| homeassistant/components/metoffice_warnings/init.py | Sets up/unloads the config entry and forwards to sensor platform |
| homeassistant/components/metoffice_warnings/config_flow.py | Adds user config flow to select and validate a UK region |
| homeassistant/components/metoffice_warnings/const.py | Defines domain constants, regions list, scan interval, base RSS URL |
| homeassistant/components/metoffice_warnings/coordinator.py | Fetches/parses RSS feed into structured warnings data |
| homeassistant/components/metoffice_warnings/sensor.py | Exposes feed pubDate as a timestamp sensor with warnings attributes |
| homeassistant/components/metoffice_warnings/manifest.json | Declares integration metadata and dependency |
| homeassistant/components/metoffice_warnings/strings.json | UI strings for config flow + entity name |
| homeassistant/components/metoffice_warnings/icons.json | Default icon for the warnings sensor |
| homeassistant/components/metoffice_warnings/quality_scale.yaml | Integration quality scale checklist status |
| tests/components/metoffice_warnings/* | Adds config flow/coordinator/sensor tests and fixtures |
| homeassistant/brands/metoffice.json | Groups metoffice + metoffice_warnings under one brand |
| homeassistant/generated/config_flows.py | Registers config flow domain (generated) |
| homeassistant/generated/integrations.json | Adds brand grouping entry for Met Office (generated) |
| script/hassfest/quality_scale.py | Adds integration domain to hassfest quality scale checks |
| CODEOWNERS | Adds code ownership for new integration and tests |
| requirements_all.txt / requirements_test_all.txt | Adds component comment marker for requirements tracking |
| .pre-commit-config.yaml | Extends codespell ignore list to include “humber” |
|
Hmm, is there a way we can find the region for a location and just merge this with the metoffice integration? |
I was thinking about this approach too but ultimately decided to keep them separate for two main reasons:
|
Use async context manager for aiohttp responses to ensure proper cleanup, remove unused logging import, and fix except clause syntax. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mark docs and integration-owner rules as done, add quality_scale to manifest, and remove from INTEGRATIONS_WITHOUT_SCALE list. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new metoffice_warnings integration to Home Assistant Core to fetch UK Met Office weather warnings from the Met Office RSS feed, including config flow, coordinator-based polling, a timestamp sensor, brand grouping with the existing metoffice integration, and corresponding tests/fixtures.
Changes:
- Introduce the new
metoffice_warningsintegration (config flow, coordinator, sensor entity, translations, manifest, quality scale). - Add comprehensive tests and XML fixtures for normal, empty, and error/edge-case feeds.
- Add brand metadata + update generated integration/config-flow indices and CODEOWNERS.
Reviewed changes
Copilot reviewed 24 out of 26 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
homeassistant/components/metoffice_warnings/__init__.py |
Sets up/unloads the integration and forwards the sensor platform. |
homeassistant/components/metoffice_warnings/config_flow.py |
User config flow to select region and validate connectivity. |
homeassistant/components/metoffice_warnings/const.py |
Defines domain/constants, scan interval, base URL, and supported regions. |
homeassistant/components/metoffice_warnings/coordinator.py |
Fetches/parses RSS XML and exposes structured warning data via coordinator. |
homeassistant/components/metoffice_warnings/sensor.py |
Timestamp sensor exposing feed update time + warning details in attributes. |
homeassistant/components/metoffice_warnings/manifest.json |
Declares integration metadata and dependency on defusedxml. |
homeassistant/components/metoffice_warnings/strings.json |
UI strings for config flow and sensor name translation. |
homeassistant/components/metoffice_warnings/icons.json |
Defines default icon for the sensor entity. |
homeassistant/components/metoffice_warnings/quality_scale.yaml |
Declares integration quality scale status (silver, with some gold/platinum TODOs). |
tests/components/metoffice_warnings/__init__.py |
Test package marker for the integration. |
tests/components/metoffice_warnings/conftest.py |
Test fixtures for mock config entry and mocked HTTP responses/fixtures. |
tests/components/metoffice_warnings/test_config_flow.py |
Tests config flow success, duplicate abort, and cannot-connect behavior. |
tests/components/metoffice_warnings/test_coordinator.py |
Tests parsing behavior, edge cases, and setup retry scenarios. |
tests/components/metoffice_warnings/test_sensor.py |
Tests sensor state/attributes and entity registry unique_id behavior. |
tests/components/metoffice_warnings/fixtures/warnings.xml |
Fixture RSS feed with a single warning. |
tests/components/metoffice_warnings/fixtures/multiple_warnings.xml |
Fixture RSS feed with multiple warnings. |
tests/components/metoffice_warnings/fixtures/no_warnings.xml |
Fixture RSS feed with no warnings. |
tests/components/metoffice_warnings/fixtures/no_channel.xml |
Fixture RSS-like XML missing <channel> for error handling test. |
tests/components/metoffice_warnings/fixtures/warning_edge_cases.xml |
Fixture RSS feed with validity-string edge cases. |
homeassistant/brands/metoffice.json |
Adds shared brand grouping for metoffice + metoffice_warnings. |
homeassistant/generated/integrations.json |
Updates generated integrations index to reflect the new brand grouping. |
homeassistant/generated/config_flows.py |
Adds metoffice_warnings to generated config flow index. |
CODEOWNERS |
Adds code ownership entries for the new integration and its tests. |
requirements_all.txt |
Adds an integration comment marker for dependency traceability. |
requirements_test_all.txt |
Adds an integration comment marker for dependency traceability in tests. |
.pre-commit-config.yaml |
Updates codespell ignore-words list (adds humber). |
tests/components/metoffice_warnings/fixtures/multiple_warnings.xml
Outdated
Show resolved
Hide resolved
tests/components/metoffice_warnings/fixtures/warning_edge_cases.xml
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a new Met Office Weather Warnings integration that fetches weather warnings from the Met Office RSS feed for UK regions. It creates a shared brand entry to group with the existing metoffice integration, allowing users to select different UK regions to monitor for weather warnings.
Changes:
- New integration that parses Met Office RSS feeds for weather warnings across UK regions
- Comprehensive test suite covering config flow, coordinator, and sensor functionality
- Shared brand entry grouping the new integration with the existing metoffice integration
- Support for all UK regions with proper region configuration
Reviewed changes
Copilot reviewed 24 out of 26 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| homeassistant/components/metoffice_warnings/ | Core integration code including coordinator, config flow, sensor platform, and constants |
| tests/components/metoffice_warnings/ | Comprehensive test coverage with fixtures for various warning scenarios |
| homeassistant/brands/metoffice.json | Brand configuration grouping metoffice and metoffice_warnings integrations |
| homeassistant/generated/integrations.json | Generated integration metadata reflecting the shared brand structure |
| requirements files | Added comment for defusedxml dependency (already in requirements) |
- Replace global codespell ignore for "humber" with inline comment - Wrap parsedate_to_datetime in try-except to handle invalid dates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Proposed change
Add a new integration that fetches weather warnings from the Met Office RSS feed for UK regions. Includes a shared brand entry to group with the existing metoffice integration.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: