Skip to content

Fix unhandled CommandTimeoutError in async_update - #598

Open
CL0SeY wants to merge 1 commit into
albertogeniola:masterfrom
CL0SeY:fix/timeout-error-async-update
Open

Fix unhandled CommandTimeoutError in async_update#598
CL0SeY wants to merge 1 commit into
albertogeniola:masterfrom
CL0SeY:fix/timeout-error-async-update

Conversation

@CL0SeY

@CL0SeY CL0SeY commented May 31, 2026

Copy link
Copy Markdown

Description

Fixes #597

Unhandled CommandTimeoutError exceptions in async_update were propagating up through HA's entity platform, causing switch and energy sensor entities to fail during setup and polling.

Changes

  • switch.py: Added try/except CommandTimeoutError around async_get_instant_metrics and async_get_daily_power_consumption calls, matching the pattern already used by PowerSensorWrapper, CurrentSensorWrapper, and VoltageSensorWrapper in sensor.py.
  • sensor.py: Added try/except CommandTimeoutError around the async_get_daily_power_consumption call in EnergySensorWrapper.async_update.

Disclaimer: Code changes were made using OpenCode / DeepSeek V4 Flash Free

Wraps async_get_instant_metrics and async_get_daily_power_consumption
calls in try/except CommandTimeoutError to prevent entity update failures.

Fixes albertogeniola#597
@CL0SeY

CL0SeY commented Jun 1, 2026

Copy link
Copy Markdown
Author

Thanks for the component, @albertogeniola :)
Small PR to power switches + energy sensor.

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.

Lost "mains" toggle and energy sensor

1 participant