@@ -23,16 +23,18 @@ async def get(self, request):
2323 )
2424
2525async def async_setup_view (hass ):
26- await hass . http . async_register_static_paths ( [
26+ static_paths = [
2727 StaticPathConfig (PANEL_URL , hass .config .path (f'{ BASE_PATH } /frontend/scene_presets_panel.js' ), True ),
2828 StaticPathConfig (f'/assets/{ DOMAIN } /iconset.js' , hass .config .path (f'{ BASE_PATH } /res/iconset.js' ), True )
29- ])
29+ ]
30+
31+ static_paths .extend (await get_preset_image_paths (hass ))
32+
33+ await hass .http .async_register_static_paths (static_paths )
3034
3135 hass .http .register_view (ScenePresetDataView )
3236 add_extra_js_url (hass , f"/assets/{ DOMAIN } /iconset.js?{ VERSION } " )
3337
34- await bind_preset_images (hass )
35-
3638 async_register_built_in_panel (
3739 hass ,
3840 component_name = "custom" ,
@@ -52,7 +54,7 @@ async def async_setup_view(hass):
5254async def async_remove_view (hass ):
5355 async_remove_panel (hass , "scene_presets" )
5456
55- async def bind_preset_images (hass ):
57+ async def get_preset_image_paths (hass ):
5658 static_paths = []
5759
5860 for preset in PRESET_DATA .get ("presets" , []):
@@ -72,4 +74,4 @@ async def bind_preset_images(hass):
7274 )
7375 )
7476
75- await hass . http . async_register_static_paths ( static_paths )
77+ return static_paths
0 commit comments