From 76c16a5111511af93c92230a1c01a19542405f9f Mon Sep 17 00:00:00 2001 From: techartdev Date: Fri, 20 Feb 2026 22:04:04 +0200 Subject: [PATCH] fixing messages in stt mode --- CHANGELOG.md | 6 ++++++ custom_components/openclaw/__init__.py | 2 +- custom_components/openclaw/manifest.json | 2 +- custom_components/openclaw/www/openclaw-chat-card.js | 9 ++++++++- www/openclaw-chat-card.js | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4bb1f3..fbf864a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to the OpenClaw Home Assistant Integration will be documented in this file. +## [0.1.35] - 2026-02-20 + +### Fixed +- Improved chat-card reliability when using voice send flow by re-subscribing to `openclaw_message_received` after card reconnects. +- Added backend history-sync fallback after message send so user/assistant messages still appear when an event is missed. + ## [0.1.34] - 2026-02-20 ### Changed diff --git a/custom_components/openclaw/__init__.py b/custom_components/openclaw/__init__.py index b70b785..a139464 100644 --- a/custom_components/openclaw/__init__.py +++ b/custom_components/openclaw/__init__.py @@ -78,7 +78,7 @@ _CARD_PATH = Path(__file__).parent / "www" / _CARD_FILENAME # URL at which the card JS is served (registered via register_static_path) _CARD_STATIC_URL = f"/openclaw/{_CARD_FILENAME}" # Versioned URL used for Lovelace resource registration to avoid stale browser cache -_CARD_URL = f"{_CARD_STATIC_URL}?v=0.1.34" +_CARD_URL = f"{_CARD_STATIC_URL}?v=0.1.35" OpenClawConfigEntry = ConfigEntry diff --git a/custom_components/openclaw/manifest.json b/custom_components/openclaw/manifest.json index 60bef96..0b62234 100644 --- a/custom_components/openclaw/manifest.json +++ b/custom_components/openclaw/manifest.json @@ -8,7 +8,7 @@ "iot_class": "local_polling", "issue_tracker": "https://github.com/techartdev/OpenClawHomeAssistant/issues", "requirements": [], - "version": "0.1.34", + "version": "0.1.35", "dependencies": ["conversation"], "after_dependencies": ["hassio", "lovelace"] } diff --git a/custom_components/openclaw/www/openclaw-chat-card.js b/custom_components/openclaw/www/openclaw-chat-card.js index fec54d2..48060b0 100644 --- a/custom_components/openclaw/www/openclaw-chat-card.js +++ b/custom_components/openclaw/www/openclaw-chat-card.js @@ -13,7 +13,7 @@ * + subscribes to openclaw_message_received events. */ -const CARD_VERSION = "0.3.2"; +const CARD_VERSION = "0.3.3"; // Max time (ms) to show the thinking indicator before falling back to an error const THINKING_TIMEOUT_MS = 120_000; @@ -131,6 +131,7 @@ class OpenClawChatCard extends HTMLElement { } connectedCallback() { + this._subscribeToEvents(); this._syncHistoryFromBackend(); this._loadIntegrationSettings(); this._render(); @@ -425,6 +426,8 @@ class OpenClawChatCard extends HTMLElement { async _sendMessage(text) { if (!text || !text.trim() || !this._hass) return; + await this._subscribeToEvents(); + const message = text.trim(); this._addMessage("user", message); @@ -447,6 +450,10 @@ class OpenClawChatCard extends HTMLElement { message: message, session_id: this._config.session_id || undefined, }); + + setTimeout(() => { + this._syncHistoryFromBackend(1); + }, 1200); } catch (err) { console.error("OpenClaw: Failed to send message:", err); // Replace thinking with error diff --git a/www/openclaw-chat-card.js b/www/openclaw-chat-card.js index 224d974..caa3545 100644 --- a/www/openclaw-chat-card.js +++ b/www/openclaw-chat-card.js @@ -1,7 +1,7 @@ (async () => { try { if (!customElements.get("openclaw-chat-card")) { - const src = "/openclaw/openclaw-chat-card.js?v=0.1.34"; + const src = "/openclaw/openclaw-chat-card.js?v=0.1.35"; console.info("OpenClaw loader importing", src); await import(src); }