feat: add call_action service for invoking MIoT actions by siid/aiid#1672
Open
rodrigoscna wants to merge 1 commit into
Open
feat: add call_action service for invoking MIoT actions by siid/aiid#1672rodrigoscna wants to merge 1 commit into
rodrigoscna wants to merge 1 commit into
Conversation
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
xiaomi_home.call_actionservice that allows invoking arbitrary MIoT actions on devices by specifyingsiid,aiid, and optionalparams, enabling use cases like per-room vacuum cleaning from the xiaomi-vacuum-map-cardservices.yamlwith the service definition and register the service handler in__init__.py, resolvingentity_idto the correctMIoTClientand devicedidvia the entity and device registriesMotivation
The integration currently exposes MIoT actions only as Button entities (no input) or Notify entities (with input), but provides no generic service to call arbitrary actions by
siid/aiid. This makes it impossible to trigger parameterized actions like segment/room cleaning from Lovelace cards or automations.Integrations like
hass-xiaomi-miotprovidexiaomi_miot.call_actionfor this purpose. This PR brings equivalent functionality toha_xiaomi_home, making it a viable replacement for users who rely on thexiaomi-vacuum-map-cardfor per-room cleaning.The underlying
MIoTClient.action_async(did, siid, aiid, in_list)already existed and handles routing (gateway > LAN > cloud) -- this PR simply exposes it as a Home Assistant service.Example usage
Test plan
xiaomi_home.call_actionservice appears in Developer Tools > Services after loading the integrationentity_id,siid, andaiid(no params) and confirm the action executes on the deviceparamsand confirm parameters are passed correctlyentity_idand confirm a clear error is raisedservice: xiaomi_home.call_actionfor per-room cleaning