fix(homeassistant): use target object for todo domain service calls#27272
Open
wali-reheman wants to merge 1 commit into
Open
fix(homeassistant): use target object for todo domain service calls#27272wali-reheman wants to merge 1 commit into
wali-reheman wants to merge 1 commit into
Conversation
Collaborator
|
Competing fix: #27270 addresses the same issue (#27256) with a more comprehensive approach — it fixes the root cause ( |
This comment was marked as spam.
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).
338a7b3 to
a2a8a3a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
_build_service_payload()now accepts an optionaldomainparameter. Whendomain == "todo"and anentity_idis provided, the entity is wrapped in atargetobject. All other domains behave exactly as before.Fixes
Fixes #27256