Fix/temp missing circuit in snapshots#217
Merged
cayossarian merged 4 commits intomainfrom Apr 7, 2026
Merged
Conversation
During panel reboots the SPAN panel can send incomplete MQTT snapshots with circuits temporarily absent. Select entities crashed with KeyError in _get_circuit(); sensor get_data_source used inconsistent error types. - select.py: _get_circuit() returns None for missing circuits; caller skips update cycle gracefully - sensor_circuit.py: all get_data_source() implementations use .get() and raise KeyError (matching the handler in _handle_online_state) - power sensor changed from ValueError to KeyError for consistency
There was a problem hiding this comment.
Pull request overview
Updates the SPAN Panel Home Assistant integration to better tolerate partial snapshots (e.g., during panel reboot) where a circuit may be temporarily absent, while also bumping the span-panel-api dependency.
Changes:
- Refactors circuit sensor data-source lookup to consistently raise
KeyErrorfor missing circuits (so the base sensor handler can gracefully degrade to “unknown” instead of erroring). - Updates circuit select coordinator-update handling to skip updates when the circuit is missing from the latest snapshot.
- Bumps
span-panel-apifrom2.5.1to2.5.2and adds/updates tests and changelog entry for the reboot stability behavior.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
custom_components/span_panel/sensor_circuit.py |
Centralizes missing-circuit lookup behavior to raise KeyError consistently. |
custom_components/span_panel/select.py |
Avoids select update crashes when a circuit is missing from a snapshot. |
tests/test_sensor_entities.py |
Aligns expectations with KeyError for missing circuit data source. |
tests/test_select.py |
Adds regression test ensuring select updates are skipped when circuit is missing. |
custom_components/span_panel/manifest.json |
Updates pinned span-panel-api requirement to 2.5.2. |
pyproject.toml |
Updates pinned span-panel-api dependency to 2.5.2. |
uv.lock |
Updates locked span-panel-api version to 2.5.2. |
CHANGELOG.md |
Adds a 2.0.6 “Panel reboot stability” fix note. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.