Install
openclaw skills install @aqara/aqara-open-api-localRoute Aqara Open API requests across device, space, and automation skills with a relationship-first router, shared CLI contract, and structured handoff contract. Supports AQARA_OPEN_API_TOKEN and AQARA_ENDPOINT_URL through environment variables or AQARA CLI config.
openclaw skills install @aqara/aqara-open-api-localThis file is the single entry router for the Aqara Open Platform HTTP API skill package.
Read this file first. Use it to do four things:
device, space, or automation.Child skills:
aqara-open-api-local/device/SKILL.mdaqara-open-api-local/space/SKILL.mdaqara-open-api-local/automation/SKILL.mdUse this table before reading any child skill in depth.
| User asks for | Final intent | Next file |
|---|---|---|
| list devices, count devices, read state, control a device | device | aqara-open-api-local/device/SKILL.md |
| list spaces, create or rename spaces, move devices between spaces | space | aqara-open-api-local/space/SKILL.md |
| create automation, inspect automation, update automation config, enable or disable automation, delete automation | automation | aqara-open-api-local/automation/SKILL.md |
| room-scoped device query such as "what lights are in the living room" | device | confirm room identity, then query devices from data/devices.json |
| room-related automation such as "turn on the light when someone is in the living room" | automation | resolve room and device evidence first, then enter automation |
Treat the three business entities as related, not isolated:
space is the container and grouping scope for devicesdevice is the concrete instance that can be queried, counted, and controlledautomation is the orchestration layer that references rooms, devices, and device traitsRoute by the final action target, not by keyword count alone.
Important relationship rule:
space is the filter key and device is the answer sourceGetSpacesRequest confirms that a room exists or resolves spaceId; it does not answer which devices are inside the roomdata/devices.json by filtering devices whose room membership matches the resolved roomExamples:
devicespaceautomationRuntime configuration may come from:
AQARA_ENDPOINT_URLAQARA_OPEN_API_TOKENaqara configCredential resolution order:
AQARA_ENDPOINT_URL and AQARA_OPEN_API_TOKEN are already set.~/.aqa/config.json.aqara config set-endpoint <url> and aqara config set-token <token> when the values are not already configured.Hard credential rules:
Global execution rules:
aqara CLI instead of handwritten curl.aqara devices cache refresh is the only allowed route for GetAllDevicesWithSpaceRequest.aqara command group.type, version, msgId, and data.version must always be "v1".type is whitelist-only. Never guess nearby request names.deviceId, endpointId, functionCode, traitCode, spaceId, or automationId.aqara-open-api-local package root or that aqara is installed globally.GetSpacesRequest alone. Resolve the room first, then filter data/devices.json to produce the device list.Shared request envelope:
{
"type": "<RequestType>",
"version": "v1",
"msgId": "<unique-id>",
"data": {}
}
CLI execution note:
aqara encapsulates the request envelope and headersRequest type whitelist:
GetAllDevicesWithSpaceRequestGetDeviceTypeInfosRequestExecuteTraitRequestGetSpacesRequestCreateSpaceRequestUpdateSpaceRequestAssociateDevicesToSpaceRequestQueryAutomationCapabilitiesRequestCreateAutomationRequestUpdateAutomationRequestUpdateAutomationStatusRequestGetAutomationListRequestGetAutomationDetailsRequestDeleteAutomationRequestThis package uses two validation modes for automation work:
cache_first_generate: default path for creation. Use resolved room and device context plus data/devices.json to build an automation-instance style config.query_capabilities_required: stricter path for risky or ambiguous automation work. Upgrade to QueryAutomationCapabilitiesRequest before finalizing the config.Upgrade from cache_first_generate to query_capabilities_required when any of the following is true:
data/devices.jsonImportant rule:
data/devices.json is the default creation evidence sourceQueryAutomationCapabilitiesRequest is the escalation path, not the default first stepBefore entering a child skill, build this structured handoff contract in reasoning. These are semantic routing fields only, not new Open API request fields.
{
"finalIntentType": "device | space | automation",
"resolvedSpace": {
"name": "<spaceName or null>",
"spaceId": "<spaceId or null>",
"resolutionSource": "route | get_spaces | device_cache | unresolved"
},
"resolvedDevices": [
{
"deviceId": "<deviceId>",
"deviceName": "<display name>",
"spaceName": "<space name or null>",
"spaceId": "<spaceId or null>",
"matchReason": "exact_name | room_plus_name | type_match | parent_context"
}
],
"resolvedAutomation": {
"automationId": "<automationId or null>"
},
"ambiguityState": {
"status": "none | room | device | automation | event_enum",
"questionNeeded": true
},
"operationContext": {
"operation": "query | control | create | update | rename | status | delete",
"cacheFreshness": "fresh | stale | unknown",
"detailsLoaded": false
},
"capabilityValidationMode": "cache_first_generate | query_capabilities_required",
"branchingIntent": {
"needsSplit": false,
"reason": "<optional reason>"
}
}
resolvedSpace instead of forcing the child skill to rediscover itresolvedDevices and ask for clarification before mutationcacheFreshness as staleFollow this order. Do not skip steps.
space, device, automation.GetSpacesRequest only to confirm the room identity when needed, then use data/devices.json to reverse lookup the devices in that room.finalIntentType.Response code reminders:
code: 0 means success400 usually means invalid request data1001 usually means token expired or invalid2030 usually means device not foundRecovery rules:
data/devices.json once, then re-resolve the devicespaceId, mutation scope, and device membershipdata/devices.json or mark cacheFreshness: "stale" and stop before createPlatform note:
aqara devices cache refresh for the full device cacheNever do any of the following:
curl when an aqara command existsdata/devices.json as if it were an unconditional automation capability whitelistname, starters, condition, or actions directly under top-level dataaqara-open-api-local/device/SKILL.md — device cache-first query and controlaqara-open-api-local/space/SKILL.md — space listing and mutationaqara-open-api-local/automation/SKILL.md — automation creation and CRUDaqara-open-api-local/docs/commands.md — CLI command catalogaqara-open-api-local/data/devices.json — device cacheaqara-open-api-local/references/examples.md — intent-based example indexaqara-open-api-local/references/automation-http-examples.md — automation HTTP lifecycle examples