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.
|
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
|
## [0.1.57] - 2026-02-26
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -140,6 +140,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: OpenClawConfigEntry) ->
|
|||||||
use_ssl = entry.data.get(CONF_USE_SSL, False)
|
use_ssl = entry.data.get(CONF_USE_SSL, False)
|
||||||
verify_ssl = entry.data.get(CONF_VERIFY_SSL, True)
|
verify_ssl = entry.data.get(CONF_VERIFY_SSL, True)
|
||||||
session = async_get_clientsession(hass, verify_ssl=verify_ssl)
|
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 can come from options (user-changeable) or from initial config data
|
||||||
agent_id: str = entry.options.get(
|
agent_id: str = entry.options.get(
|
||||||
@@ -395,7 +399,6 @@ def _async_register_services(hass: HomeAssistant) -> None:
|
|||||||
"""Handle the openclaw.send_message service call."""
|
"""Handle the openclaw.send_message service call."""
|
||||||
message: str = call.data[ATTR_MESSAGE]
|
message: str = call.data[ATTR_MESSAGE]
|
||||||
session_id: str = call.data.get(ATTR_SESSION_ID) or "default"
|
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)
|
call_agent_id: str | None = call.data.get(ATTR_AGENT_ID)
|
||||||
|
|
||||||
entry_data = _get_first_entry_data(hass)
|
entry_data = _get_first_entry_data(hass)
|
||||||
|
|||||||
@@ -86,12 +86,7 @@ class OpenClawApiClient:
|
|||||||
self._token = token
|
self._token = token
|
||||||
|
|
||||||
def _headers(self, agent_id: str | None = None) -> dict[str, str]:
|
def _headers(self, agent_id: str | None = None) -> dict[str, str]:
|
||||||
"""Build request headers with auth token and agent ID.
|
"""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.
|
|
||||||
"""
|
|
||||||
effective_agent = agent_id or self._agent_id or "main"
|
effective_agent = agent_id or self._agent_id or "main"
|
||||||
return {
|
return {
|
||||||
"Authorization": f"Bearer {self._token}",
|
"Authorization": f"Bearer {self._token}",
|
||||||
@@ -201,8 +196,7 @@ class OpenClawApiClient:
|
|||||||
session_id: Optional session/conversation ID.
|
session_id: Optional session/conversation ID.
|
||||||
model: Optional model override.
|
model: Optional model override.
|
||||||
stream: If True, raises ValueError (use async_stream_message).
|
stream: If True, raises ValueError (use async_stream_message).
|
||||||
agent_id: Optional per-call agent ID override (overrides the
|
agent_id: Optional per-call agent ID override.
|
||||||
client-level default set in the constructor).
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Complete chat completion response.
|
Complete chat completion response.
|
||||||
@@ -270,8 +264,7 @@ class OpenClawApiClient:
|
|||||||
message: The user message text.
|
message: The user message text.
|
||||||
session_id: Optional session/conversation ID.
|
session_id: Optional session/conversation ID.
|
||||||
model: Optional model override.
|
model: Optional model override.
|
||||||
agent_id: Optional per-call agent ID override (overrides the
|
agent_id: Optional per-call agent ID override.
|
||||||
client-level default set in the constructor).
|
|
||||||
|
|
||||||
Yields:
|
Yields:
|
||||||
Content delta strings from the streaming response.
|
Content delta strings from the streaming response.
|
||||||
|
|||||||
@@ -20,11 +20,13 @@ try:
|
|||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlow,
|
||||||
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow
|
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow
|
||||||
|
|
||||||
ConfigFlowResult = dict[str, Any]
|
ConfigFlowResult = dict[str, Any]
|
||||||
|
OptionsFlowWithReload = OptionsFlow
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
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."""
|
"""Handle OpenClaw options."""
|
||||||
|
|
||||||
def __init__(self, config_entry: ConfigEntry) -> None:
|
def __init__(self, config_entry: ConfigEntry) -> None:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"iot_class": "local_polling",
|
"iot_class": "local_polling",
|
||||||
"issue_tracker": "https://github.com/techartdev/OpenClawHomeAssistant/issues",
|
"issue_tracker": "https://github.com/techartdev/OpenClawHomeAssistant/issues",
|
||||||
"requirements": [],
|
"requirements": [],
|
||||||
"version": "0.1.57",
|
"version": "0.1.58",
|
||||||
"dependencies": ["conversation"],
|
"dependencies": ["conversation"],
|
||||||
"after_dependencies": ["hassio", "lovelace"]
|
"after_dependencies": ["hassio", "lovelace"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user