Skip to content

Fix/temp missing circuit in snapshots#217

Merged
cayossarian merged 4 commits intomainfrom
fix/temp_missing_circuit
Apr 7, 2026
Merged

Fix/temp missing circuit in snapshots#217
cayossarian merged 4 commits intomainfrom
fix/temp_missing_circuit

Conversation

@cayossarian
Copy link
Copy Markdown
Member

No description provided.

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

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

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 KeyError for 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-api from 2.5.1 to 2.5.2 and 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.

@cayossarian cayossarian merged commit c5e4fda into main Apr 7, 2026
7 checks passed
@cayossarian cayossarian deleted the fix/temp_missing_circuit branch April 7, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants