Route OpenClaw chat by HA user
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user