Skip to content

fix(homeassistant): use target object for todo domain service calls#27272

Open
wali-reheman wants to merge 1 commit into
NousResearch:mainfrom
wali-reheman:fix/homeassistant-todo-target
Open

fix(homeassistant): use target object for todo domain service calls#27272
wali-reheman wants to merge 1 commit into
NousResearch:mainfrom
wali-reheman:fix/homeassistant-todo-target

Conversation

@wali-reheman

Copy link
Copy Markdown
Contributor

Summary

HA 2023+ changed how the domain targets entities. Service calls now require a object rather than a top-level field.

Before (broken for todo):

{ "entity_id": "todo.mylist", "status": "needs_action" }

After (correct for todo, backward-compatible for all others):

{ "target": { "entity_id": "todo.mylist" }, "data": { "status": "needs_action" } }

All other domains (light, switch, climate, etc.) continue using the flat format for backward compatibility.

Changes

  • tools/homeassistant_tool.py: _build_service_payload() now accepts an optional domain parameter. When domain == "todo" and an entity_id is provided, the entity is wrapped in a target object. All other domains behave exactly as before.
  • tests/tools/test_homeassistant_tool.py: Two new test cases for todo domain behavior.

Fixes

Fixes #27256

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tools Tool registry, model_tools, toolsets labels May 17, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing fix: #27270 addresses the same issue (#27256) with a more comprehensive approach — it fixes the root cause (?return_response=true missing from the URL for HA response-only services) rather than wrapping entity_id in a target object. #27270 also covers calendar, weather, and conversation domains, includes auto-retry logic, and has 550+ lines of test coverage. These two PRs conflict on tools/homeassistant_tool.py.

@cardtest15-coder

This comment was marked as spam.

Properly structure payload as {target: {entity_id}, data: {...}} for HA 2023+ todo domain.
Fixes KeyError when data dict is present (was flattened into payload instead of nested).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: homeassistant_tool.py fails to get_items on todo entities

3 participants