Skip to content

Conversation

@bieniu
Copy link
Member

@bieniu bieniu commented Aug 3, 2025

Breaking change

Proposed change

On August 2nd, the data structure for hydrological alerts in the IMGW-PIB API changed, causing a KeyError.

2025-08-03 12:29:50.994 ERROR (MainThread) [homeassistant.components.imgw_pib.coordinator] Unexpected error fetching imgw_pib data
Traceback (most recent call last):
  File "/home/maciek/develop/home-assistant-core/homeassistant/helpers/update_coordinator.py", line 392, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/maciek/develop/home-assistant-core/homeassistant/components/imgw_pib/coordinator.py", line 64, in _async_update_data
    return await self.imgwpib.get_hydrological_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/maciek/develop/home-assistant-core/venv/lib/python3.13/site-packages/imgw_pib/__init__.py", line 295, in get_hydrological_data
    return self._parse_hydrological_data(hydrological_data, hydrological_alerts)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/maciek/develop/home-assistant-core/venv/lib/python3.13/site-packages/imgw_pib/__init__.py", line 472, in _parse_hydrological_data
    hydrological_alert = self._extract_hydrological_alert(alerts, river, province)
  File "/home/maciek/develop/home-assistant-core/venv/lib/python3.13/site-packages/imgw_pib/__init__.py", line 502, in _extract_hydrological_alert
    if river[:-1].lower() not in alert[ApiNames.AREA].lower():
                                 ~~~~~^^^^^^^^^^^^^^^
KeyError: <ApiNames.AREA: 'obszar'>

Bumping the imgw_pib version fixes this.

Changelog: bieniu/imgw-pib@1.5.1...1.5.2

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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • 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.

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 link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@bieniu bieniu added this to the 2025.8.0 milestone Aug 3, 2025
Copilot AI review requested due to automatic review settings August 3, 2025 10:44
Copy link
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 updates the imgw_pib dependency from version 1.5.1 to 1.5.2 to fix a KeyError that occurred due to a breaking change in the IMGW-PIB API on August 2nd. The API changed the data structure for hydrological alerts, causing the integration to fail when accessing the obszar (area) field.

  • Updates imgw_pib library to version 1.5.2 to handle API data structure changes
  • Fixes KeyError in hydrological alert processing
  • Updates dependency version across all requirement files

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
requirements_all.txt Updates imgw_pib dependency version to 1.5.2
requirements_test_all.txt Updates imgw_pib test dependency version to 1.5.2
homeassistant/components/imgw_pib/manifest.json Updates imgw_pib requirement in integration manifest to 1.5.2

@zweckj zweckj merged commit e0190af into home-assistant:dev Aug 3, 2025
48 checks passed
bramkragten pushed a commit that referenced this pull request Aug 4, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Aug 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants