Fix nobo_hub KeyError when a zone or component is removed#169378
Merged
joostlek merged 2 commits intohome-assistant:devfrom Apr 28, 2026
Merged
Fix nobo_hub KeyError when a zone or component is removed#169378joostlek merged 2 commits intohome-assistant:devfrom
joostlek merged 2 commits intohome-assistant:devfrom
Conversation
Contributor
|
Hey there @echoromeo, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the Nobø Ecohub integration’s push-update handling to avoid KeyError crashes when a zone (climate/select) or component (sensor) is removed on the hub, by marking affected entities unavailable instead of dereferencing missing hub data.
Changes:
- Add availability guards in climate/select/sensor entities’
_read_statewhen the backing zone/component no longer exists on the hub. - Add regression tests verifying entities transition to
STATE_UNAVAILABLEafter a pushed update when their zone/component is removed.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| homeassistant/components/nobo_hub/climate.py | Guard missing zone IDs during _read_state to prevent push-update crashes and mark entity unavailable. |
| homeassistant/components/nobo_hub/select.py | Guard missing zone IDs for week profile selector during _read_state to prevent push-update crashes and mark entity unavailable. |
| homeassistant/components/nobo_hub/sensor.py | Guard missing component serials during _read_state to prevent push-update crashes and mark entity unavailable. |
| tests/components/nobo_hub/test_climate.py | Add test asserting a removed zone results in STATE_UNAVAILABLE after push update. |
| tests/components/nobo_hub/test_select.py | Add test asserting a removed zone results in STATE_UNAVAILABLE after push update. |
| tests/components/nobo_hub/test_sensor.py | Add test asserting a removed component results in STATE_UNAVAILABLE after push update. |
joostlek
approved these changes
Apr 28, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Proposed change
Removing a zone via the Nobø app causes the integration to raise
KeyErrorthe next time the hub pushes a state update:The same crash exists for the
NoboProfileSelector(zone id) andNoboTemperatureSensor(component serial) push paths.This PR adds a guard in each platform's
_read_statethat marks the entity unavailable when its underlying zone (climate, select) or component (sensor) is no longer present in the hub's data, instead of dereferencing a missing key. Availability is restored on the next push update if the zone/component reappears.Out of scope: dynamically adding entities for zones/components added on the hub, and removing the entity registry entries for removed ones. Those will follow as the
dynamic-devices/stale-devicesquality-scale work.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: