Skip to content

Commit f723483

Browse files
committed
v1.0.8: Fix static path registration using modern HA async API
v1.0.7 used the deprecated synchronous register_static_path() which silently fails on HA 2024.x+, causing "Unable to load custom panel". Now uses async_register_static_paths() with StaticPathConfig (the correct API for HA 2024.1+), with a fallback to the legacy method. Made-with: Cursor
1 parent d388e5b commit f723483

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to Ultra Card Pro Cloud will be documented in this file.
44

5+
## [1.0.8] - 2026-02-25
6+
7+
### Fixed
8+
- **Sidebar panel now actually loads** – v1.0.7 registered the static path using HA's deprecated synchronous API which silently fails on HA 2024.x+. Now uses `async_register_static_paths` (the correct modern API), with a fallback to the legacy method for older HA versions. Users who saw the "Unable to load custom panel" error after updating to v1.0.7 should update to this version.
9+
510
## [1.0.7] - 2026-02-25
611

712
### Fixed

custom_components/ultra_card_pro_cloud/__init__.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,22 @@ async def async_setup(hass: HomeAssistant, config: dict) -> bool:
5353
www_path = Path(__file__).parent / "www"
5454
if www_path.exists() and not hass.data.get(f"{DOMAIN}_static_registered"):
5555
try:
56-
hass.http.register_static_path(
57-
PANEL_STATIC_URL_PATH,
58-
str(www_path),
59-
cache_headers=True,
60-
)
56+
# Use the modern async API (HA 2024.x+). Falls back to the legacy
57+
# synchronous method for older installations.
58+
from homeassistant.components.http import StaticPathConfig
59+
await hass.http.async_register_static_paths([
60+
StaticPathConfig(PANEL_STATIC_URL_PATH, str(www_path), cache_headers=True),
61+
])
6162
hass.data[f"{DOMAIN}_static_registered"] = True
6263
_LOGGER.info("Registered static path %s → %s", PANEL_STATIC_URL_PATH, www_path)
64+
except (ImportError, AttributeError):
65+
# Fallback for HA versions that don't have async_register_static_paths
66+
try:
67+
hass.http.register_static_path(PANEL_STATIC_URL_PATH, str(www_path), cache_headers=True)
68+
hass.data[f"{DOMAIN}_static_registered"] = True
69+
_LOGGER.info("Registered static path (legacy) %s → %s", PANEL_STATIC_URL_PATH, www_path)
70+
except Exception as static_err:
71+
_LOGGER.warning("Could not register static path for panel JS: %s", static_err)
6372
except Exception as static_err:
6473
_LOGGER.warning("Could not register static path for panel JS: %s", static_err)
6574
elif not www_path.exists():

custom_components/ultra_card_pro_cloud/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
"iot_class": "cloud_polling",
1212
"issue_tracker": "https://github.com/WJDDesigns/ultra-card-pro-cloud/issues",
1313
"requirements": [],
14-
"version": "1.0.7"
14+
"version": "1.0.8"
1515
}

version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
This is the single source of truth for version information.
44
"""
55

6-
__version__ = "1.0.7"
6+
__version__ = "1.0.8"

0 commit comments

Comments
 (0)