From 8f82526bb97d15eee1840156b4a1ea83343a7932 Mon Sep 17 00:00:00 2001 From: techartdev Date: Mon, 23 Feb 2026 11:14:18 +0200 Subject: [PATCH] Bump version to 0.1.51, fix chat input focus loss, and update card version --- CHANGELOG.md | 5 ++++ custom_components/openclaw/__init__.py | 2 +- custom_components/openclaw/manifest.json | 2 +- .../openclaw/www/openclaw-chat-card.js | 29 +++++++++++++++++-- www/openclaw-chat-card.js | 2 +- 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92a9929..4ae4754 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to the OpenClaw Home Assistant Integration will be documented in this file. +## [0.1.51] - 2026-02-23 + +### Fixed +- Fixed chat input focus loss while typing by preventing unnecessary card re-renders on frequent Home Assistant state updates. + ## [0.1.50] - 2026-02-21 ### Fixed diff --git a/custom_components/openclaw/__init__.py b/custom_components/openclaw/__init__.py index 50692aa..88bf02b 100644 --- a/custom_components/openclaw/__init__.py +++ b/custom_components/openclaw/__init__.py @@ -92,7 +92,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.50" +_CARD_URL = f"{_CARD_STATIC_URL}?v=0.1.51" OpenClawConfigEntry = ConfigEntry diff --git a/custom_components/openclaw/manifest.json b/custom_components/openclaw/manifest.json index 79487b9..43cfd8a 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.50", + "version": "0.1.51", "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 b679937..8500a20 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.9"; +const CARD_VERSION = "0.3.10"; // Max time (ms) to show the thinking indicator before falling back to an error const THINKING_TIMEOUT_MS = 120_000; @@ -94,6 +94,7 @@ class OpenClawChatCard extends HTMLElement { this._assistAutoStopTimer = null; this._lastAssistantEventSignature = null; this._autoScrollPinned = true; + this._lastHassRenderSignature = null; } // ── HA card interface ─────────────────────────────────────────────── @@ -126,12 +127,36 @@ class OpenClawChatCard extends HTMLElement { set hass(hass) { const firstSet = !this._hass; this._hass = hass; + const currentSignature = this._getHassRenderSignature(hass); if (firstSet) { this._subscribeToEvents(); this._syncHistoryFromBackend(); this._loadIntegrationSettings(); } - this._render(); + if (firstSet || currentSignature !== this._lastHassRenderSignature) { + this._lastHassRenderSignature = currentSignature; + this._render(); + } + } + + _getHassRenderSignature(hass) { + const states = hass?.states || {}; + const stateEntries = Object.entries(states); + + const statusEntity = + states["sensor.openclaw_status"] || + stateEntries.find(([entityId]) => entityId.startsWith("sensor.openclaw_status"))?.[1] || + null; + + const binaryEntity = + states["binary_sensor.openclaw_connected"] || + stateEntries.find(([entityId]) => entityId.startsWith("binary_sensor.openclaw_connected"))?.[1] || + null; + + const status = String(statusEntity?.state || "").toLowerCase(); + const connectedState = String(binaryEntity?.state || "").toLowerCase(); + + return `${status}|${connectedState}`; } _getGatewayConnectionState() { diff --git a/www/openclaw-chat-card.js b/www/openclaw-chat-card.js index ecb3cc7..91de999 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.50"; + const src = "/openclaw/openclaw-chat-card.js?v=0.1.51"; console.info("OpenClaw loader importing", src); await import(src); }