Merge branch 'main' into feature/configurable-agent-id
This commit is contained in:
@@ -2,6 +2,16 @@
|
||||
|
||||
All notable changes to the OpenClaw Home Assistant Integration will be documented in this file.
|
||||
|
||||
## [0.1.58] - 2026-03-07
|
||||
|
||||
### Added
|
||||
- Added configurable OpenClaw `agent_id` support for manual setup, integration options, and per-call `openclaw.send_message` service overrides.
|
||||
- Added `x-openclaw-agent-id` routing support in the API client so messages can target non-`main` OpenClaw agents.
|
||||
|
||||
### Changed
|
||||
- Saving OpenClaw integration options now reloads the integration automatically, so updated `agent_id` and other runtime options apply immediately.
|
||||
- Added service descriptions and translations for the new `agent_id` field in the configuration UI.
|
||||
|
||||
## [0.1.57] - 2026-02-26
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -140,6 +140,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: OpenClawConfigEntry) ->
|
||||
use_ssl = entry.data.get(CONF_USE_SSL, False)
|
||||
verify_ssl = entry.data.get(CONF_VERIFY_SSL, True)
|
||||
session = async_get_clientsession(hass, verify_ssl=verify_ssl)
|
||||
agent_id: str = entry.options.get(
|
||||
CONF_AGENT_ID,
|
||||
entry.data.get(CONF_AGENT_ID, DEFAULT_AGENT_ID),
|
||||
)
|
||||
|
||||
# agent_id can come from options (user-changeable) or from initial config data
|
||||
agent_id: str = entry.options.get(
|
||||
@@ -395,7 +399,6 @@ def _async_register_services(hass: HomeAssistant) -> None:
|
||||
"""Handle the openclaw.send_message service call."""
|
||||
message: str = call.data[ATTR_MESSAGE]
|
||||
session_id: str = call.data.get(ATTR_SESSION_ID) or "default"
|
||||
# Per-call agent_id overrides the client-level default when provided.
|
||||
call_agent_id: str | None = call.data.get(ATTR_AGENT_ID)
|
||||
|
||||
entry_data = _get_first_entry_data(hass)
|
||||
|
||||
@@ -86,12 +86,7 @@ class OpenClawApiClient:
|
||||
self._token = token
|
||||
|
||||
def _headers(self, agent_id: str | None = None) -> dict[str, str]:
|
||||
"""Build request headers with auth token and agent ID.
|
||||
|
||||
Args:
|
||||
agent_id: Per-call agent ID override. Falls back to the
|
||||
client-level ``agent_id`` set in the constructor.
|
||||
"""
|
||||
"""Build request headers with auth token and agent ID."""
|
||||
effective_agent = agent_id or self._agent_id or "main"
|
||||
return {
|
||||
"Authorization": f"Bearer {self._token}",
|
||||
@@ -201,8 +196,7 @@ class OpenClawApiClient:
|
||||
session_id: Optional session/conversation ID.
|
||||
model: Optional model override.
|
||||
stream: If True, raises ValueError (use async_stream_message).
|
||||
agent_id: Optional per-call agent ID override (overrides the
|
||||
client-level default set in the constructor).
|
||||
agent_id: Optional per-call agent ID override.
|
||||
|
||||
Returns:
|
||||
Complete chat completion response.
|
||||
@@ -270,8 +264,7 @@ class OpenClawApiClient:
|
||||
message: The user message text.
|
||||
session_id: Optional session/conversation ID.
|
||||
model: Optional model override.
|
||||
agent_id: Optional per-call agent ID override (overrides the
|
||||
client-level default set in the constructor).
|
||||
agent_id: Optional per-call agent ID override.
|
||||
|
||||
Yields:
|
||||
Content delta strings from the streaming response.
|
||||
|
||||
@@ -20,11 +20,13 @@ try:
|
||||
ConfigFlow,
|
||||
ConfigFlowResult,
|
||||
OptionsFlow,
|
||||
OptionsFlowWithReload,
|
||||
)
|
||||
except ImportError:
|
||||
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow
|
||||
|
||||
ConfigFlowResult = dict[str, Any]
|
||||
OptionsFlowWithReload = OptionsFlow
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
@@ -439,7 +441,7 @@ class OpenClawConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
)
|
||||
|
||||
|
||||
class OpenClawOptionsFlow(OptionsFlow):
|
||||
class OpenClawOptionsFlow(OptionsFlowWithReload):
|
||||
"""Handle OpenClaw options."""
|
||||
|
||||
def __init__(self, config_entry: ConfigEntry) -> None:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"iot_class": "local_polling",
|
||||
"issue_tracker": "https://github.com/techartdev/OpenClawHomeAssistant/issues",
|
||||
"requirements": [],
|
||||
"version": "0.1.57",
|
||||
"version": "0.1.58",
|
||||
"dependencies": ["conversation"],
|
||||
"after_dependencies": ["hassio", "lovelace"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user