Skip to content

Commit 5ec32e1

Browse files
authored
Merge branch 'main' into feature/configurable-agent-id
2 parents fa0af8d + e0c0c7b commit 5ec32e1

5 files changed

Lines changed: 21 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
All notable changes to the OpenClaw Home Assistant Integration will be documented in this file.
44

5+
## [0.1.58] - 2026-03-07
6+
7+
### Added
8+
- Added configurable OpenClaw `agent_id` support for manual setup, integration options, and per-call `openclaw.send_message` service overrides.
9+
- Added `x-openclaw-agent-id` routing support in the API client so messages can target non-`main` OpenClaw agents.
10+
11+
### Changed
12+
- Saving OpenClaw integration options now reloads the integration automatically, so updated `agent_id` and other runtime options apply immediately.
13+
- Added service descriptions and translations for the new `agent_id` field in the configuration UI.
14+
515
## [0.1.57] - 2026-02-26
616

717
### Changed

custom_components/openclaw/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: OpenClawConfigEntry) ->
140140
use_ssl = entry.data.get(CONF_USE_SSL, False)
141141
verify_ssl = entry.data.get(CONF_VERIFY_SSL, True)
142142
session = async_get_clientsession(hass, verify_ssl=verify_ssl)
143+
agent_id: str = entry.options.get(
144+
CONF_AGENT_ID,
145+
entry.data.get(CONF_AGENT_ID, DEFAULT_AGENT_ID),
146+
)
143147

144148
# agent_id can come from options (user-changeable) or from initial config data
145149
agent_id: str = entry.options.get(
@@ -395,7 +399,6 @@ async def handle_send_message(call: ServiceCall) -> None:
395399
"""Handle the openclaw.send_message service call."""
396400
message: str = call.data[ATTR_MESSAGE]
397401
session_id: str = call.data.get(ATTR_SESSION_ID) or "default"
398-
# Per-call agent_id overrides the client-level default when provided.
399402
call_agent_id: str | None = call.data.get(ATTR_AGENT_ID)
400403

401404
entry_data = _get_first_entry_data(hass)

custom_components/openclaw/api.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,7 @@ def update_token(self, token: str) -> None:
8686
self._token = token
8787

8888
def _headers(self, agent_id: str | None = None) -> dict[str, str]:
89-
"""Build request headers with auth token and agent ID.
90-
91-
Args:
92-
agent_id: Per-call agent ID override. Falls back to the
93-
client-level ``agent_id`` set in the constructor.
94-
"""
89+
"""Build request headers with auth token and agent ID."""
9590
effective_agent = agent_id or self._agent_id or "main"
9691
return {
9792
"Authorization": f"Bearer {self._token}",
@@ -201,8 +196,7 @@ async def async_send_message(
201196
session_id: Optional session/conversation ID.
202197
model: Optional model override.
203198
stream: If True, raises ValueError (use async_stream_message).
204-
agent_id: Optional per-call agent ID override (overrides the
205-
client-level default set in the constructor).
199+
agent_id: Optional per-call agent ID override.
206200
207201
Returns:
208202
Complete chat completion response.
@@ -270,8 +264,7 @@ async def async_stream_message(
270264
message: The user message text.
271265
session_id: Optional session/conversation ID.
272266
model: Optional model override.
273-
agent_id: Optional per-call agent ID override (overrides the
274-
client-level default set in the constructor).
267+
agent_id: Optional per-call agent ID override.
275268
276269
Yields:
277270
Content delta strings from the streaming response.

custom_components/openclaw/config_flow.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@
2020
ConfigFlow,
2121
ConfigFlowResult,
2222
OptionsFlow,
23+
OptionsFlowWithReload,
2324
)
2425
except ImportError:
2526
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow
2627

2728
ConfigFlowResult = dict[str, Any]
29+
OptionsFlowWithReload = OptionsFlow
2830
from homeassistant.core import HomeAssistant
2931
from homeassistant.helpers.aiohttp_client import async_get_clientsession
3032

@@ -439,7 +441,7 @@ async def async_step_manual(
439441
)
440442

441443

442-
class OpenClawOptionsFlow(OptionsFlow):
444+
class OpenClawOptionsFlow(OptionsFlowWithReload):
443445
"""Handle OpenClaw options."""
444446

445447
def __init__(self, config_entry: ConfigEntry) -> None:

custom_components/openclaw/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"iot_class": "local_polling",
99
"issue_tracker": "https://github.com/techartdev/OpenClawHomeAssistant/issues",
1010
"requirements": [],
11-
"version": "0.1.57",
11+
"version": "0.1.58",
1212
"dependencies": ["conversation"],
1313
"after_dependencies": ["hassio", "lovelace"]
1414
}

0 commit comments

Comments
 (0)