Fix model selection, docs links, cache-busting, and Assist routing

This commit is contained in:
root
2026-04-04 16:28:35 +03:00
parent 7050441f8d
commit e17bd0aa85
11 changed files with 121 additions and 138 deletions
+5 -10
View File
@@ -14,7 +14,7 @@ from typing import Any
from homeassistant.components.event import EventEntity, EventEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.core import callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import (
@@ -53,10 +53,6 @@ async def async_setup_entry(
]
async_add_entities(entities)
# Wire HA bus events → entity triggers
for entity in entities:
entity.async_start_listening(hass)
class OpenClawEventEntity(EventEntity):
"""Event entity that mirrors HA bus events into the entity registry."""
@@ -78,11 +74,10 @@ class OpenClawEventEntity(EventEntity):
"model": "OpenClaw Gateway",
}
self._entry_id = entry.entry_id
self._unsub: callback | None = None
self._unsub = None
@callback
def async_start_listening(self, hass: HomeAssistant) -> None:
"""Subscribe to the matching HA bus event."""
async def async_added_to_hass(self) -> None:
"""Subscribe to the matching HA bus event after the entity is added."""
key = self.entity_description.key
if key == "message_received":
@@ -103,7 +98,7 @@ class OpenClawEventEntity(EventEntity):
self._trigger_event(event_type, data)
self.async_write_ha_state()
self._unsub = hass.bus.async_listen(bus_event, _handle_event)
self._unsub = self.hass.bus.async_listen(bus_event, _handle_event)
async def async_will_remove_from_hass(self) -> None:
"""Unsubscribe when entity is removed."""