Skip to content

Commit c82f22e

Browse files
author
Franz646
committed
fix: restore hass.http.app, wrap rmtree in executor — v2.3.1
- Revert aiohttp app workaround: use hass.http.app directly with http in dependencies - Fix blocking call: shutil.rmtree(__pycache__) now runs in async_add_executor_job - Bump 2.3.0 -> 2.3.1
1 parent 42604cc commit c82f22e

4 files changed

Lines changed: 11 additions & 16 deletions

File tree

custom_components/orphan_cleaner/__init__.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
3434

3535
_pycache = pathlib.Path(__file__).parent / "__pycache__"
3636
if _pycache.exists():
37-
shutil.rmtree(_pycache, ignore_errors=True)
38-
39-
# Access aiohttp app directly without referencing the http component
40-
_runner = getattr(hass, "_aiohttp_runner", None)
41-
_app = getattr(_runner, "app", None) if _runner else None
42-
if _app is None:
43-
# Fallback: try internal server attribute
44-
_srv = getattr(hass, "_" + "http", None)
45-
_app = getattr(_srv, "app", None) if _srv else None
46-
if _app is None:
47-
_LOGGER.warning("Could not access aiohttp app — panel routes not registered")
48-
return False
49-
async_register_views(hass, _app)
37+
await hass.async_add_executor_job(
38+
lambda: shutil.rmtree(_pycache, ignore_errors=True)
39+
)
40+
41+
async_register_views(hass, hass.http.app)
5042
async_register_services(hass)
5143

5244
# Remove any previously registered panel before re-registering

custom_components/orphan_cleaner/const.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@
4747
PANEL_ICON = "mdi:broom"
4848

4949
# Versione corrente (usata per cache-busting)
50-
VERSION = "2.3.0"
50+
VERSION = "2.3.1"

custom_components/orphan_cleaner/frontend/panel.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@
234234
<svg viewBox="0 0 24 24"><path d="M19.36 2.72 20.78 4.14l-1.4 1.41 1.41 1.41-4.24 4.24-1.41-1.41-6.89 6.9a4 4 0 0 1-1.2 4.71l-2.83 2.12-1.41-1.41 2.12-2.83a2 2 0 0 0 .27-2.1l-.27-.42L3 15.36l1.41-1.41 1.42 1.42 5.65-5.66-1.41-1.41 4.24-4.24 1.41 1.41z"/></svg>
235235
</div>
236236
<div>
237-
<div class="topbar-title">Orphan Entity Cleaner <span style="font-size:11px;font-weight:400;color:var(--text2);margin-left:6px">v2.3.0</span></div>
237+
<div class="topbar-title">Orphan Entity Cleaner <span style="font-size:11px;font-weight:400;color:var(--text2);margin-left:6px">v2.3.1</span></div>
238238
<div class="topbar-sub">Home Assistant Integration — orphan entity cleanup</div>
239239
</div>
240240
<div class="topbar-spacer"></div>

custom_components/orphan_cleaner/manifest.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
"@Franz646"
66
],
77
"config_flow": true,
8+
"dependencies": [
9+
"http"
10+
],
811
"documentation": "https://github.com/Franz646/orphan-cleaner",
912
"integration_type": "service",
1013
"iot_class": "local_push",
1114
"issue_tracker": "https://github.com/Franz646/orphan-cleaner/issues",
1215
"requirements": [],
13-
"version": "2.3.0"
16+
"version": "2.3.1"
1417
}

0 commit comments

Comments
 (0)