Fix model selection, docs links, cache-busting, and Assist routing
This commit is contained in:
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user