File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
custom_components/pyscript Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -150,8 +150,12 @@ async def watchdog_start(
150150 class WatchDogHandler (FileSystemEventHandler ):
151151 """Class for handling watchdog events."""
152152
153- def __init__ (self , watchdog_q : asyncio .Queue ) -> None :
153+ def __init__ (
154+ self , watchdog_q : asyncio .Queue , observer : watchdog .observers .Observer , path : str
155+ ) -> None :
154156 self .watchdog_q = watchdog_q
157+ self ._observer = observer
158+ self ._observer .schedule (self , path , recursive = True )
155159
156160 def process (self , event : FileSystemEvent ) -> None :
157161 """Send watchdog events to main loop task."""
@@ -221,7 +225,7 @@ def check_event(event, do_reload: bool) -> bool:
221225 hass .data [DOMAIN ][WATCHDOG_OBSERVER ] = observer
222226 hass .data [DOMAIN ][WATCHDOG_TASK ] = Function .create_task (task_watchdog (watchdog_q ))
223227
224- observer . schedule (WatchDogHandler ( watchdog_q ), pyscript_folder , recursive = True )
228+ await hass . async_add_executor_job (WatchDogHandler , watchdog_q , observer , pyscript_folder )
225229
226230
227231async def async_setup_entry (hass : HomeAssistant , config_entry : ConfigEntry ) -> bool :
You can’t perform that action at this time.
0 commit comments