From 0bc0c9f72c0817390bb39d95139b2d455093bc2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C6=B0u=20Quang=20V=C5=A9?= Date: Thu, 7 May 2026 09:29:35 +0700 Subject: [PATCH 1/3] Resolve `Devices Schedules Restart Handler` uses an unknown action --- devices_schedules_restart_handler.yaml | 22 +++++++++++++++++++++- pyproject.toml | 4 ++-- scripts/common_utilities.py | 1 + scripts/requirements.txt | 2 +- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/devices_schedules_restart_handler.yaml b/devices_schedules_restart_handler.yaml index 3c925c0..71bea64 100644 --- a/devices_schedules_restart_handler.yaml +++ b/devices_schedules_restart_handler.yaml @@ -71,15 +71,35 @@ mode: queued max_exceeded: silent variables: - version: 20260222 + version: 20260507 triggers: - trigger: homeassistant event: start + id: homeassistant_start + - trigger: event + event_type: pyscript_ready + event_data: + script: common_utilities + id: pyscript_ready conditions: [] actions: + - choose: + - conditions: + - condition: trigger + id: homeassistant_start + sequence: + - wait_for_trigger: + - trigger: event + event_type: pyscript_ready + event_data: + script: common_utilities + timeout: + seconds: 60 + continue_on_timeout: true + - variables: _index_key: !input registry_index_key _prefix: !input registry_timer_prefix diff --git a/pyproject.toml b/pyproject.toml index d7a0fb1..ab1bb3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,8 +11,8 @@ dev = [ "beautifulsoup4", "curl-cffi", "google-api-python-client", - "h2", - "homeassistant>=2026.4.0", + "h2>=4,<5", + "homeassistant>=2026.5.0", "ruff", ] diff --git a/scripts/common_utilities.py b/scripts/common_utilities.py index a15aab0..7e3e8ab 100644 --- a/scripts/common_utilities.py +++ b/scripts/common_utilities.py @@ -246,6 +246,7 @@ async def initialize_cache_db() -> None: """Initialize cache and prune expired entries on startup.""" await _cache_prepare_db(force=True) await _prune_expired() + event.fire("pyscript_ready", script=__name__) # noqa: F821 @time_trigger("cron(0 * * * *)") # noqa: F821 diff --git a/scripts/requirements.txt b/scripts/requirements.txt index dcb6abb..2726034 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -1,5 +1,5 @@ # common -h2 +h2>=4,<5 # youtube_data_tool google-api-python-client From a73b2973fe8e1961c86eec4e2c37889b54dfb421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C6=B0u=20Quang=20V=C5=A9?= Date: Thu, 7 May 2026 09:33:10 +0700 Subject: [PATCH 2/3] Update requirement --- scripts/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/requirements.txt b/scripts/requirements.txt index 2726034..dcb6abb 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -1,5 +1,5 @@ # common -h2>=4,<5 +h2 # youtube_data_tool google-api-python-client From e66ad5a813860ced61d56426f53f9682f8ab7bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C6=B0u=20Quang=20V=C5=A9?= Date: Thu, 7 May 2026 09:56:59 +0700 Subject: [PATCH 3/3] Resolve Devices Schedules Restart Handler uses an unknown action --- devices_schedules_restart_handler.yaml | 23 ++++------------------- scripts/common_utilities.py | 10 +++++++++- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/devices_schedules_restart_handler.yaml b/devices_schedules_restart_handler.yaml index 71bea64..48f7242 100644 --- a/devices_schedules_restart_handler.yaml +++ b/devices_schedules_restart_handler.yaml @@ -76,29 +76,14 @@ variables: triggers: - trigger: homeassistant event: start - id: homeassistant_start - - trigger: event - event_type: pyscript_ready - event_data: - script: common_utilities - id: pyscript_ready conditions: [] actions: - - choose: - - conditions: - - condition: trigger - id: homeassistant_start - sequence: - - wait_for_trigger: - - trigger: event - event_type: pyscript_ready - event_data: - script: common_utilities - timeout: - seconds: 60 - continue_on_timeout: true + - wait_template: "{{ is_state('binary_sensor.pyscript_common_utilities', 'on') }}" + timeout: + seconds: 60 + continue_on_timeout: true - variables: _index_key: !input registry_index_key diff --git a/scripts/common_utilities.py b/scripts/common_utilities.py index 7e3e8ab..14dfe45 100644 --- a/scripts/common_utilities.py +++ b/scripts/common_utilities.py @@ -246,7 +246,15 @@ async def initialize_cache_db() -> None: """Initialize cache and prune expired entries on startup.""" await _cache_prepare_db(force=True) await _prune_expired() - event.fire("pyscript_ready", script=__name__) # noqa: F821 + state.set( # noqa: F821 + f"binary_sensor.pyscript_{__name__}", + "on", + { + "friendly_name": f"Pyscript {__name__.replace('_', ' ').title()}", + "device_class": "connectivity", + }, + ) + log.info(f"Pyscript {__name__} is ready.") # noqa: F821 @time_trigger("cron(0 * * * *)") # noqa: F821