Route OpenClaw chat by HA user

This commit is contained in:
2026-05-06 08:08:18 +02:00
parent 90d525e842
commit 8221098ebc
12 changed files with 285 additions and 68 deletions
+4 -2
View File
@@ -72,7 +72,8 @@ class OpenClawModelSelect(CoordinatorEntity[OpenClawCoordinator], SelectEntity):
# Initialise from coordinator cache
models = coordinator.available_models
self._attr_options = models if models else ["unknown"]
current = (coordinator.data or {}).get(DATA_MODEL)
selected = entry.options.get(description.key)
current = selected or (coordinator.data or {}).get(DATA_MODEL)
self._attr_current_option = current if current in self._attr_options else (
self._attr_options[0] if self._attr_options else None
)
@@ -83,7 +84,8 @@ class OpenClawModelSelect(CoordinatorEntity[OpenClawCoordinator], SelectEntity):
models = self.coordinator.available_models
if models:
self._attr_options = models
current = (self.coordinator.data or {}).get(DATA_MODEL)
selected = self._entry.options.get(self.entity_description.key)
current = selected or (self.coordinator.data or {}).get(DATA_MODEL)
if current and current in self._attr_options:
self._attr_current_option = current
self.async_write_ha_state()