Added AuroraWatch UK Integration.#164544
Added AuroraWatch UK Integration.#164544agentgonzo wants to merge 5 commits intohome-assistant:devfrom
Conversation
There was a problem hiding this comment.
Hello @agentgonzo,
When attempting to inspect the commits of your pull request for CLA signature status among all authors we encountered commit(s) which were not linked to a GitHub account, thus not allowing us to determine their status(es).
The commits that are missing a linked GitHub account are the following:
be9bbd22dfa689d95124591f81a76df9fcaa200b- This commit has something that looks like an email address (steve@magma). Maybe try linking that to GitHub?.
Unfortunately, we are unable to accept this pull request until this situation is corrected.
Here are your options:
-
If you had an email address set for the commit that simply wasn't linked to your GitHub account you can link that email now and it will retroactively apply to your commits. The simplest way to do this is to click the link to one of the above commits and look for a blue question mark in a blue circle in the top left. Hovering over that bubble will show you what email address you used. Clicking on that button will take you to your email address settings on GitHub. Just add the email address on that page and you're all set. GitHub has more information about this option in their help center.
-
If you didn't use an email address at all, it was an invalid email, or it's one you can't link to your GitHub, you will need to change the authorship information of the commit and your global Git settings so this doesn't happen again going forward. GitHub provides some great instructions on how to change your authorship information in their help center.
- If you only made a single commit you should be able to run
(substituting "Author Name" and "
git commit --amend --author="Author Name <email@address.com>"email@address.com" for your actual information) to set the authorship information. - If you made more than one commit and the commit with the missing authorship information is not the most recent one you have two options:
- You can re-create all commits missing authorship information. This is going to be the easiest solution for developers that aren't extremely confident in their Git and command line skills.
- You can use this script that GitHub provides to rewrite history. Please note: this should be used only if you are very confident in your abilities and understand its impacts.
- Whichever method you choose, I will come by to re-check the pull request once you push the fixes to this branch.
- If you only made a single commit you should be able to run
We apologize for this inconvenience, especially since it usually bites new contributors to Home Assistant. We hope you understand the need for us to protect ourselves and the great community we all have built legally. The best thing to come out of this is that you only need to fix this once and it benefits the entire Home Assistant and GitHub community.
Thanks, I look forward to checking this PR again soon! ❤️
There was a problem hiding this comment.
Hi @agentgonzo
It seems you haven't yet signed a CLA. Please do so here.
Once you do that we will be able to review and accept this pull request.
Thanks!
There was a problem hiding this comment.
Hello @agentgonzo,
When attempting to inspect the commits of your pull request for CLA signature status among all authors we encountered commit(s) which were not linked to a GitHub account, thus not allowing us to determine their status(es).
The commits that are missing a linked GitHub account are the following:
-
6983d6c7eb783d722cc8d65161c7a89c75ef5a53- This commit has something that looks like an email address (steve@magma). Maybe try linking that to GitHub?. -
af1296d83613cb692cddb6c082deef0596d6741e- This commit has something that looks like an email address (steve@magma). Maybe try linking that to GitHub?.
Unfortunately, we are unable to accept this pull request until this situation is corrected.
Here are your options:
-
If you had an email address set for the commit that simply wasn't linked to your GitHub account you can link that email now and it will retroactively apply to your commits. The simplest way to do this is to click the link to one of the above commits and look for a blue question mark in a blue circle in the top left. Hovering over that bubble will show you what email address you used. Clicking on that button will take you to your email address settings on GitHub. Just add the email address on that page and you're all set. GitHub has more information about this option in their help center.
-
If you didn't use an email address at all, it was an invalid email, or it's one you can't link to your GitHub, you will need to change the authorship information of the commit and your global Git settings so this doesn't happen again going forward. GitHub provides some great instructions on how to change your authorship information in their help center.
- If you only made a single commit you should be able to run
(substituting "Author Name" and "
git commit --amend --author="Author Name <email@address.com>"email@address.com" for your actual information) to set the authorship information. - If you made more than one commit and the commit with the missing authorship information is not the most recent one you have two options:
- You can re-create all commits missing authorship information. This is going to be the easiest solution for developers that aren't extremely confident in their Git and command line skills.
- You can use this script that GitHub provides to rewrite history. Please note: this should be used only if you are very confident in your abilities and understand its impacts.
- Whichever method you choose, I will come by to re-check the pull request once you push the fixes to this branch.
- If you only made a single commit you should be able to run
We apologize for this inconvenience, especially since it usually bites new contributors to Home Assistant. We hope you understand the need for us to protect ourselves and the great community we all have built legally. The best thing to come out of this is that you only need to fix this once and it benefits the entire Home Assistant and GitHub community.
Thanks, I look forward to checking this PR again soon! ❤️
There was a problem hiding this comment.
Pull request overview
Adds a new Home Assistant core integration (aurorawatch) to monitor AuroraWatch UK geomagnetic/aurora status via cloud polling.
Changes:
- Introduces a new AuroraWatch UK config flow, coordinator, base entity, and sensor platform.
- Adds translations (
strings.json) and icons metadata (icons.json) plus integration artwork. - Adds initial test coverage for config flow and sensor behavior.
Reviewed changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
homeassistant/components/aurorawatch/__init__.py |
Sets up/unloads the config entry and wires the coordinator to the sensor platform |
homeassistant/components/aurorawatch/config_flow.py |
Provides a simple “confirm setup” config flow (single-instance) |
homeassistant/components/aurorawatch/const.py |
Defines API endpoints, polling interval, and attribute keys |
homeassistant/components/aurorawatch/coordinator.py |
Fetches/parses the AuroraWatch XML endpoints and exposes coordinator data |
homeassistant/components/aurorawatch/entity.py |
Defines the shared CoordinatorEntity base, device info, unique IDs |
homeassistant/components/aurorawatch/sensor.py |
Implements the “aurora status” and “geomagnetic activity” sensors |
homeassistant/components/aurorawatch/manifest.json |
Declares integration metadata (domain, docs URL, config flow, etc.) |
homeassistant/components/aurorawatch/strings.json |
Adds config flow and entity translation strings |
homeassistant/components/aurorawatch/icons.json |
Adds default icons for the sensors |
homeassistant/components/aurorawatch/icon.png / logo.png |
Adds integration icon and logo assets |
tests/components/aurorawatch/__init__.py |
Adds a small helper to set up the integration in tests |
tests/components/aurorawatch/conftest.py |
Adds fixtures and sample XML payloads for tests |
tests/components/aurorawatch/test_config_flow.py |
Tests the basic config flow and “already configured” abort |
tests/components/aurorawatch/test_sensor.py |
Tests entity creation, states/attributes, and error scenarios |
You can also share your feedback on Copilot code review. Take the survey.
| @property | ||
| def extra_state_attributes(self): | ||
| """Return the state attributes.""" | ||
| if not self.coordinator.data: | ||
| return {} |
| # Mock invalid XML response (missing required fields) | ||
| mock_response = AsyncMock() | ||
| mock_response.text = AsyncMock(return_value=MOCK_INVALID_STATUS_XML) | ||
| mock_response.raise_for_status = AsyncMock() | ||
| mock_session.get.return_value = mock_response |
| def native_value(self): | ||
| """Return the state of the sensor.""" | ||
| if self.coordinator.data: | ||
| return self.coordinator.data.get("status") | ||
| return None |
| except Exception as err: | ||
| _LOGGER.error("Error fetching AuroraWatch data: %s", err) | ||
| raise UpdateFailed(f"Error communicating with API: {err}") from err |
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 introduces a new Home Assistant integration, aurorawatch, to monitor AuroraWatch UK geomagnetic/aurora status via a cloud-polled API, including config flow, coordinator-based data fetching, sensor entities, and accompanying tests/translations/icons.
Changes:
- Added
aurorawatchintegration scaffolding (manifest, config flow, coordinator, entities, sensors, translations, icons). - Implemented polling of AuroraWatch UK XML endpoints and exposed two sensors (status + geomagnetic activity).
- Added pytest coverage for config flow and sensor behavior (including failure scenarios).
Reviewed changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
homeassistant/components/aurorawatch/__init__.py |
Sets up/unloads the integration and forwards platforms |
homeassistant/components/aurorawatch/config_flow.py |
Provides UI-based setup flow |
homeassistant/components/aurorawatch/const.py |
Defines domain/constants, endpoints, and polling interval |
homeassistant/components/aurorawatch/coordinator.py |
Fetches/parses AuroraWatch XML data via a coordinator |
homeassistant/components/aurorawatch/entity.py |
Base coordinator entity + device info + unique ID |
homeassistant/components/aurorawatch/sensor.py |
Implements the two sensor entities |
homeassistant/components/aurorawatch/manifest.json |
Declares integration metadata |
homeassistant/components/aurorawatch/strings.json |
Adds config flow + entity name translations |
homeassistant/components/aurorawatch/icons.json |
Supplies entity icons |
homeassistant/components/aurorawatch/icon.png |
Integration icon asset |
homeassistant/components/aurorawatch/logo.png |
Integration logo asset |
tests/components/aurorawatch/__init__.py |
Test helper for setting up the integration |
tests/components/aurorawatch/conftest.py |
Test fixtures and mocked XML responses |
tests/components/aurorawatch/test_config_flow.py |
Config flow tests |
tests/components/aurorawatch/test_sensor.py |
Sensor/entity/coordinator behavior tests |
You can also share your feedback on Copilot code review. Take the survey.
| except Exception as err: | ||
| _LOGGER.error("Error fetching AuroraWatch data: %s", err) | ||
| raise UpdateFailed(f"Error communicating with API: {err}") from err |
| async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: | ||
| """Unload a config entry.""" | ||
| # Unload platforms | ||
| unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) | ||
|
|
||
| # Remove coordinator from hass.data | ||
| if unload_ok: | ||
| hass.data[DOMAIN].pop(entry.entry_id) | ||
|
|
| self._attr_unique_id = ( | ||
| f"{coordinator.config_entry.entry_id}_{translation_key}" | ||
| ) | ||
| self._attr_device_info = DeviceInfo( | ||
| entry_type=DeviceEntryType.SERVICE, | ||
| identifiers={(DOMAIN, coordinator.config_entry.entry_id)}, |
joostlek
left a comment
There was a problem hiding this comment.
Hey 👋🏻,
There are a couple things going on with the PR:
- The CI is failing.
- You don't seem to have a proper development environment. Please make sure you have one as some files are missing from the PR
- The service specific details should be put in a package hosted on PyPI
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new Home Assistant core integration (aurorawatch) to monitor AuroraWatch UK geomagnetic activity and expose it via sensor entities, including config flow, translations, icons, and tests.
Changes:
- Introduces the AuroraWatch UK integration with config flow, data update coordinator, base entity, and sensor platform.
- Adds translations (
strings.json) and entity icons (icons.json) plus integration branding assets. - Adds initial pytest coverage for config flow and sensor behavior/error handling.
Reviewed changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
homeassistant/components/aurorawatch/__init__.py |
Sets up/unloads the config entry and initializes the coordinator/platforms |
homeassistant/components/aurorawatch/config_flow.py |
Implements a simple UI config flow (single-instance setup) |
homeassistant/components/aurorawatch/const.py |
Defines domain, API endpoints, polling interval, and attribute keys |
homeassistant/components/aurorawatch/coordinator.py |
Fetches and parses AuroraWatch XML data via DataUpdateCoordinator |
homeassistant/components/aurorawatch/entity.py |
Provides a coordinator-backed base entity with device info/IDs |
homeassistant/components/aurorawatch/sensor.py |
Exposes status + activity sensors backed by the coordinator |
homeassistant/components/aurorawatch/strings.json |
Adds config flow and entity naming strings |
homeassistant/components/aurorawatch/icons.json |
Adds default icons for the new sensors |
homeassistant/components/aurorawatch/manifest.json |
Declares integration metadata and capabilities |
homeassistant/components/aurorawatch/icon.png |
Integration icon asset |
homeassistant/components/aurorawatch/logo.png |
Integration logo asset |
tests/components/aurorawatch/__init__.py |
Test helper to set up the integration |
tests/components/aurorawatch/conftest.py |
Shared fixtures and mocked XML responses |
tests/components/aurorawatch/test_config_flow.py |
Tests config flow creation and duplicate handling |
tests/components/aurorawatch/test_sensor.py |
Tests sensor states/attributes and failure behaviors |
You can also share your feedback on Copilot code review. Take the survey.
| async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: | ||
| """Set up AuroraWatch UK from a config entry.""" | ||
| coordinator = AurowatchDataUpdateCoordinator(hass) | ||
|
|
||
| # Perform the first refresh and raise ConfigEntryNotReady on failure | ||
| await coordinator.async_config_entry_first_refresh() | ||
|
|
| """Set up the AuroraWatch sensor.""" | ||
| coordinator = cast( | ||
| AurowatchDataUpdateCoordinator, | ||
| hass.data[DOMAIN][entry.entry_id], | ||
| ) |
| @property | ||
| def extra_state_attributes(self): | ||
| """Return the state attributes.""" | ||
| data = self.coordinator.data or {} | ||
| return { | ||
| ATTR_LAST_UPDATED: data.get("last_updated"), | ||
| ATTR_PROJECT_ID: data.get("project_id"), | ||
| ATTR_SITE_ID: data.get("site_id"), | ||
| ATTR_SITE_URL: data.get("site_url"), | ||
| ATTR_API_VERSION: data.get("api_version"), | ||
| } |
| # Try to obtain the config entry ID from the coordinator if available. | ||
| config_entry = getattr(coordinator, "config_entry", None) | ||
| entry_id = getattr(config_entry, "entry_id", None) | ||
|
|
||
| if entry_id is not None: | ||
| base_id = entry_id | ||
| else: | ||
| # Fallback base ID when the coordinator has no config_entry. | ||
| # This avoids AttributeError while still providing a stable ID. | ||
| base_id = translation_key | ||
|
|
||
| self._attr_unique_id = f"{base_id}_{translation_key}" | ||
| self._attr_device_info = DeviceInfo( | ||
| entry_type=DeviceEntryType.SERVICE, | ||
| identifiers={(DOMAIN, base_id)}, | ||
| manufacturer="Lancaster University", |
| except (AttributeError, KeyError) as err: | ||
| _LOGGER.error("Failed to extract data from XML: %s", err) | ||
| raise UpdateFailed(f"Failed to parse XML structure: {err}") from err | ||
|
|
| # Mock session.get to return different responses based on URL | ||
| async def mock_get(url: str, *args, **kwargs): | ||
| """Return an async context manager yielding the appropriate response.""" | ||
| if "current-status.xml" in url: | ||
| response = mock_status_response | ||
| elif "sum-activity.xml" in url: | ||
| response = mock_activity_response | ||
| else: | ||
| response = AsyncMock() | ||
|
|
||
| context_manager = AsyncMock() | ||
| context_manager.__aenter__.return_value = response | ||
| context_manager.__aexit__.return_value = AsyncMock(return_value=None) | ||
|
|
||
| return context_manager | ||
|
|
||
| mock_session.get = mock_get |
| with patch( | ||
| "homeassistant.components.aurorawatch.coordinator.async_get_clientsession" | ||
| ) as mock_session_factory: | ||
| mock_session = AsyncMock() | ||
| mock_session_factory.return_value = mock_session | ||
|
|
||
| # Mock malformed XML response | ||
| mock_response = AsyncMock() | ||
| mock_response.text = AsyncMock(return_value=MOCK_MALFORMED_XML) | ||
| mock_response.raise_for_status = Mock() | ||
| mock_session.get.return_value = mock_response | ||
|
|
| with patch( | ||
| "homeassistant.components.aurorawatch.coordinator.async_get_clientsession" | ||
| ) as mock_session_factory: | ||
| mock_session = AsyncMock() | ||
| mock_session_factory.return_value = mock_session | ||
|
|
||
| # Mock invalid XML response (missing required fields) | ||
| mock_response = AsyncMock() | ||
| mock_response.text = AsyncMock(return_value=MOCK_INVALID_STATUS_XML) | ||
| mock_response.raise_for_status = Mock() | ||
| mock_session.get.return_value = mock_response | ||
|
|
| "config_flow": true, | ||
| "documentation": "https://www.home-assistant.io/integrations/aurorawatch", | ||
| "integration_type": "service", | ||
| "iot_class": "cloud_polling", |
| _LOGGER = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class AurowatchDataUpdateCoordinator(DataUpdateCoordinator): |
https://aurorawatch.lancs.ac.uk/
Proposed change
Added integration for Aurora Watch UK
https://aurorawatch.lancs.ac.uk/
This adds the geomagnetic activity from the University of Lancaster
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: