Skip to content

feat: add call_action service for invoking MIoT actions by siid/aiid#1672

Open
rodrigoscna wants to merge 1 commit into
XiaoMi:mainfrom
kanso-labs:main
Open

feat: add call_action service for invoking MIoT actions by siid/aiid#1672
rodrigoscna wants to merge 1 commit into
XiaoMi:mainfrom
kanso-labs:main

Conversation

@rodrigoscna

Copy link
Copy Markdown

Summary

  • Add xiaomi_home.call_action service that allows invoking arbitrary MIoT actions on devices by specifying siid, aiid, and optional params, enabling use cases like per-room vacuum cleaning from the xiaomi-vacuum-map-card
  • Create services.yaml with the service definition and register the service handler in __init__.py, resolving entity_id to the correct MIoTClient and device did via the entity and device registries

Motivation

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-miot provide xiaomi_miot.call_action for this purpose. This PR brings equivalent functionality to ha_xiaomi_home, making it a viable replacement for users who rely on the xiaomi-vacuum-map-card for 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

service: xiaomi_home.call_action
data:
  entity_id: vacuum.my_vacuum
  siid: 2
  aiid: 13
  params:
    - '{"room":[[3,5,7]]}'

Test plan

  • Verify the xiaomi_home.call_action service appears in Developer Tools > Services after loading the integration
  • Call the service with a valid entity_id, siid, and aiid (no params) and confirm the action executes on the device
  • Call the service with params and confirm parameters are passed correctly
  • Call the service with an invalid entity_id and confirm a clear error is raised
  • Verify the xiaomi-vacuum-map-card works with service: xiaomi_home.call_action for per-room cleaning

@CLAassistant

CLAassistant commented Mar 5, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants