Skip to content

Add Met Office Weather Warnings integration#165602

Open
ianByrne wants to merge 6 commits intohome-assistant:devfrom
ianByrne:add-metoffice-warnings
Open

Add Met Office Weather Warnings integration#165602
ianByrne wants to merge 6 commits intohome-assistant:devfrom
ianByrne:add-metoffice-warnings

Conversation

@ianByrne
Copy link
Copy Markdown
Contributor

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

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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”

@joostlek
Copy link
Copy Markdown
Member

Hmm, is there a way we can find the region for a location and just merge this with the metoffice integration?

@ianByrne
Copy link
Copy Markdown
Contributor Author

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:

  • if someone lives on the edge of a "warning" region, they may wish to follow the warnings of two regions
  • if someone only wants the warnings but not the metoffice weather forecasts, then they don't need to faff around with setting up an API token that wouldn't be used

ianByrne and others added 2 commits March 15, 2026 14:14
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>
Copilot AI review requested due to automatic review settings March 15, 2026 14:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_warnings integration (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).

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 22, 2026 13:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants