diff --git a/advanced_youtube_search_full_llm.yaml b/advanced_youtube_search_full_llm.yaml index a52bcaa..fd488e7 100644 --- a/advanced_youtube_search_full_llm.yaml +++ b/advanced_youtube_search_full_llm.yaml @@ -13,7 +13,7 @@ blueprint: - The `scripts/youtube_data_tool.py` script needs to be copied into the `config/pyscript` folder. - The `scripts/requirements.txt` file needs to be copied into the `config/pyscript` folder. - The mentioned file(s) is/are included in the repository. - - Enable two Pyscript configuration options in `config/configuration.yaml` to permit the import of any Python package and to expose hass as a variable. + - You need to enable two Pyscript options through the UI or via YAML to allow importing all Python packages and to make hass available as a global variable. - A YouTube API key needs to be configured in `config/configuration.yaml` and `config/secrets.yaml`. ``` diff --git a/create_lunar_events.yaml b/create_lunar_events.yaml index af8d0d9..001ab03 100644 --- a/create_lunar_events.yaml +++ b/create_lunar_events.yaml @@ -12,7 +12,7 @@ blueprint: - The Pyscript integration needs to be installed through HACS and properly configured. - The `scripts/date_conversion_tool.py` script needs to be copied into the `config/pyscript` folder. - The mentioned file(s) is/are included in the repository. - - Enable two Pyscript configuration options in `config/configuration.yaml` to permit the import of any Python package and to expose hass as a variable. + - You need to enable two Pyscript options through the UI or via YAML to allow importing all Python packages and to make hass available as a global variable. ``` # File configuration.yaml diff --git a/date_lookup_and_conversion_full_llm.yaml b/date_lookup_and_conversion_full_llm.yaml index 75cc0f4..a1e5f53 100644 --- a/date_lookup_and_conversion_full_llm.yaml +++ b/date_lookup_and_conversion_full_llm.yaml @@ -12,7 +12,7 @@ blueprint: - The Pyscript integration needs to be installed through HACS and properly configured. - The `scripts/date_conversion_tool.py` script needs to be copied into the `config/pyscript` folder. - The mentioned file(s) is/are included in the repository. - - Enable two Pyscript configuration options in `config/configuration.yaml` to permit the import of any Python package and to expose hass as a variable. + - You need to enable two Pyscript options through the UI or via YAML to allow importing all Python packages and to make hass available as a global variable. ``` # File configuration.yaml diff --git a/devices_schedules.yaml b/devices_schedules.yaml index b99ad1c..e06b81a 100644 --- a/devices_schedules.yaml +++ b/devices_schedules.yaml @@ -19,7 +19,7 @@ blueprint: - The `scripts/common_utilities.py` script need to be copied into the `config/pyscript` folder. - This blueprint is a dependency for the `devices_schedules_full_llm.yaml` and the `devices_schedules_restart_handler.yaml` blueprints. - The mentioned file(s) is/are included in the repository. - - Enable two Pyscript configuration options in `config/configuration.yaml` to permit the import of any Python package and to expose hass as a variable. + - You need to enable two Pyscript options through the UI or via YAML to allow importing all Python packages and to make hass available as a global variable. ``` # File configuration.yaml diff --git a/devices_schedules_restart_handler.yaml b/devices_schedules_restart_handler.yaml index 3381e6e..e752140 100644 --- a/devices_schedules_restart_handler.yaml +++ b/devices_schedules_restart_handler.yaml @@ -16,7 +16,7 @@ blueprint: - The `scripts/common_utilities.py` script need to be copied into the `config/pyscript` folder. - The `devices_schedules.yaml` blueprint needs to be installed. - The mentioned file(s) is/are included in the repository. - - Enable two Pyscript configuration options in `config/configuration.yaml` to permit the import of any Python package and to expose hass as a variable. + - You need to enable two Pyscript options through the UI or via YAML to allow importing all Python packages and to make hass available as a global variable. ``` # File configuration.yaml diff --git a/memory_tool_full_llm.yaml b/memory_tool_full_llm.yaml index 1a15d8b..5a3db26 100644 --- a/memory_tool_full_llm.yaml +++ b/memory_tool_full_llm.yaml @@ -12,7 +12,7 @@ blueprint: - The Pyscript integration needs to be installed through HACS and properly configured. - The `scripts/memory.py` script needs to be copied into the `config/pyscript` folder. - The mentioned file(s) is/are included in the repository. - - Enable two Pyscript configuration options in `config/configuration.yaml` to permit the import of any Python package and to expose hass as a variable. + - You need to enable two Pyscript options through the UI or via YAML to allow importing all Python packages and to make hass available as a global variable. ``` # File configuration.yaml diff --git a/memory_tool_local.yaml b/memory_tool_local.yaml index 4321e23..ae830cd 100644 --- a/memory_tool_local.yaml +++ b/memory_tool_local.yaml @@ -12,7 +12,7 @@ blueprint: - The Pyscript integration needs to be installed through HACS and properly configured. - The `scripts/memory.py` and `scripts/common_utilities.py` scripts need to be copied into the `config/pyscript` folder. - The mentioned file(s) is/are included in the repository. - - Enable two Pyscript configuration options in `config/configuration.yaml` to permit the import of any Python package and to expose hass as a variable. + - You need to enable two Pyscript options through the UI or via YAML to allow importing all Python packages and to make hass available as a global variable. ``` # File configuration.yaml diff --git a/scripts/telegram_bot_handle_tool.py b/scripts/telegram_bot_handle_tool.py index ef1fbb6..9c41367 100644 --- a/scripts/telegram_bot_handle_tool.py +++ b/scripts/telegram_bot_handle_tool.py @@ -663,7 +663,7 @@ async def get_telegram_updates( selector: number: min: 30 - max: 60 + max: 120 step: 1 default: 30 offset: @@ -684,7 +684,16 @@ async def get_telegram_updates( """ try: session = await _ensure_session() - return await _get_updates(session, timeout=timeout, offset=offset, limit=limit) + response = await _get_updates( + session, timeout=timeout, offset=offset, limit=limit + ) + if not response or not response.get("result"): + return { + "ok": True, + "result": [], + "description": "No updates found. Please send a message to the bot first to ensure there is data to retrieve.", + } + return response except Exception as error: return {"error": f"An unexpected error occurred during processing: {error}"} diff --git a/scripts/zalo_bot_handle_tool.py b/scripts/zalo_bot_handle_tool.py index 83a2913..f7571af 100644 --- a/scripts/zalo_bot_handle_tool.py +++ b/scripts/zalo_bot_handle_tool.py @@ -565,17 +565,24 @@ async def get_zalo_updates(timeout: int = 30) -> dict[str, Any]: fields: timeout: name: Timeout - description: Server wait time before responding (30-60 seconds). + description: Server wait time before responding. selector: number: min: 30 - max: 60 + max: 120 step: 1 default: 30 """ try: session = await _ensure_session() - return await _get_updates(session, timeout=timeout) + response = await _get_updates(session, timeout=timeout) + if not response or not response.get("result"): + return { + "ok": True, + "result": [], + "description": "No updates found. Please send a message to the bot first to ensure there is data to retrieve.", + } + return response except Exception as error: return {"error": f"An unexpected error occurred during processing: {error}"} diff --git a/send_to_telegram_full_llm.yaml b/send_to_telegram_full_llm.yaml index a636a4d..b9b3ef6 100644 --- a/send_to_telegram_full_llm.yaml +++ b/send_to_telegram_full_llm.yaml @@ -14,7 +14,7 @@ blueprint: - The `scripts/telegram_bot_handle_tool.py` script needs to be copied into the `config/pyscript` folder. - The `scripts/requirements.txt` file needs to be copied into the `config/pyscript` folder. - The mentioned file(s) is/are included in the repository. - - Enable two Pyscript configuration options in `config/configuration.yaml` to permit the import of any Python package and to expose hass as a variable. + - You need to enable two Pyscript options through the UI or via YAML to allow importing all Python packages and to make hass available as a global variable. - A Telegram bot token needs to be configured in `config/configuration.yaml` and `config/secrets.yaml`. ``` diff --git a/send_to_zalo_bot_full_llm.yaml b/send_to_zalo_bot_full_llm.yaml index 1cf0d8a..97b3fc6 100644 --- a/send_to_zalo_bot_full_llm.yaml +++ b/send_to_zalo_bot_full_llm.yaml @@ -14,7 +14,7 @@ blueprint: - The `scripts/zalo_bot_handle_tool.py` script needs to be copied into the `config/pyscript` folder. - The `scripts/requirements.txt` file needs to be copied into the `config/pyscript` folder. - The mentioned file(s) is/are included in the repository. - - Enable two Pyscript configuration options in `config/configuration.yaml` to permit the import of any Python package and to expose hass as a variable. + - You need to enable two Pyscript options through the UI or via YAML to allow importing all Python packages and to make hass available as a global variable. - A Zalo bot token needs to be configured in `config/configuration.yaml` and `config/secrets.yaml`. ``` diff --git a/telegram_bot_webhook.yaml b/telegram_bot_webhook.yaml index 1837a47..6a521cd 100644 --- a/telegram_bot_webhook.yaml +++ b/telegram_bot_webhook.yaml @@ -16,7 +16,7 @@ blueprint: - The `scripts/telegram_bot_handle_tool.py` and `scripts/common_utilities.py` scripts need to be copied into the `config/pyscript` folder. - The `scripts/requirements.txt` file needs to be copied into the `config/pyscript` folder. - The mentioned file(s) is/are included in the repository. - - Enable two Pyscript configuration options in `config/configuration.yaml` to permit the import of any Python package and to expose hass as a variable. + - You need to enable two Pyscript options through the UI or via YAML to allow importing all Python packages and to make hass available as a global variable. - A Telegram bot token needs to be configured in `config/configuration.yaml` and `config/secrets.yaml`. ``` diff --git a/traffic_fine_lookup_full_llm.yaml b/traffic_fine_lookup_full_llm.yaml index 7790fbc..146374d 100644 --- a/traffic_fine_lookup_full_llm.yaml +++ b/traffic_fine_lookup_full_llm.yaml @@ -13,7 +13,7 @@ blueprint: - The `scripts/traffic_fine_lookup_tool.py` script needs to be copied into the `config/pyscript` folder. - The `scripts/requirements.txt` file needs to be copied into the `config/pyscript` folder. - The mentioned file(s) is/are included in the repository. - - Enable two Pyscript configuration options in `config/configuration.yaml` to permit the import of any Python package and to expose hass as a variable. + - You need to enable two Pyscript options through the UI or via YAML to allow importing all Python packages and to make hass available as a global variable. - A Gemini API key needs to be configured in `config/configuration.yaml` and `config/secrets.yaml`, as it's required for solving CAPTCHAs. ``` diff --git a/zalo_bot_webhook.yaml b/zalo_bot_webhook.yaml index b82d16b..d7a1aa2 100644 --- a/zalo_bot_webhook.yaml +++ b/zalo_bot_webhook.yaml @@ -14,7 +14,7 @@ blueprint: - The `scripts/zalo_bot_handle_tool.py` and `scripts/common_utilities.py` scripts need to be copied into the `config/pyscript` folder. - The `scripts/requirements.txt` file needs to be copied into the `config/pyscript` folder. - The mentioned file(s) is/are included in the repository. - - Enable two Pyscript configuration options in `config/configuration.yaml` to permit the import of any Python package and to expose hass as a variable. + - You need to enable two Pyscript options through the UI or via YAML to allow importing all Python packages and to make hass available as a global variable. - A Zalo bot token needs to be configured in `config/configuration.yaml` and `config/secrets.yaml`. ``` diff --git a/zalo_custom_bot_webhook.yaml b/zalo_custom_bot_webhook.yaml index 76d1b23..546de0f 100644 --- a/zalo_custom_bot_webhook.yaml +++ b/zalo_custom_bot_webhook.yaml @@ -15,7 +15,7 @@ blueprint: - The `scripts/requirements.txt` file needs to be copied into the `config/pyscript` folder. - The mentioned file(s) is/are included in the repository. - Update the Webhook URL to the Zalo Bot Server after saving the script. - - Enable two Pyscript configuration options in `config/configuration.yaml` to permit the import of any Python package and to expose hass as a variable. + - You need to enable two Pyscript options through the UI or via YAML to allow importing all Python packages and to make hass available as a global variable. ``` # File configuration.yaml