Skip to content

Fetch wallbox status via HTTP for real-time updates#113

Draft
derolli1976 wants to merge 2 commits intodevfrom
bug/109-bug-wallboxdaten-nicht-aktuell
Draft

Fetch wallbox status via HTTP for real-time updates#113
derolli1976 wants to merge 2 commits intodevfrom
bug/109-bug-wallboxdaten-nicht-aktuell

Conversation

@derolli1976
Copy link
Copy Markdown
Owner

Description

Wallbox status sensors (wallbox_mode, wallbox_status) now reflect external changes (e.g. charging started/stopped via the native Enpal app) within the normal polling interval.

Previously in native (Blazor/WebSocket) mode, get_wallbox_data() only returned cached values from _mode and _status. These were only updated when the integration itself clicked a button (triggering a RenderBatch) or when the WebSocket connection was re-established (up to every 5 minutes). Changes made outside the integration (e.g. via the Enpal app) were invisible because they occurred in a separate Blazor circuit.

Now, get_wallbox_data() performs a lightweight HTTP GET to /wallbox on every poll. Blazor Server pre-renders the current component state into the HTML response, so we parse "Mode X" and "Status Y" using the existing _extract_status_text() logic. The WebSocket connection remains open and undisturbed for button clicks.

Motivation and Context

Users reported that the wallbox status sensors did not update when charging was started/stopped or the mode was changed via the native Enpal app instead of through the Home Assistant integration. The root cause was that Blazor Server only pushes RenderBatch updates to its own circuit — external changes were never propagated to our WebSocket connection.

How Has This Been Tested?

  • All 38 unit tests in custom_components/enpal_webparser/tests/ pass without regressions.
  • The 7 failing tests in tests_root/ are pre-existing integration tests that require a live Enpal Box connection and are unrelated to this change.
  • The new _fetch_status_via_http() method reuses the battle-tested _extract_status_text() parser that already handles RenderBatch data.

Screenshots (if appropriate):

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@derolli1976 derolli1976 added this to the v3.0.0 milestone Mar 18, 2026
@derolli1976 derolli1976 self-assigned this Mar 18, 2026
@derolli1976 derolli1976 linked an issue Mar 18, 2026 that may be closed by this pull request
@derolli1976 derolli1976 marked this pull request as draft March 19, 2026 07:55
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.

[Bug] Wallboxdaten nicht aktuell

1 participant