GB-Power-Market-JJ aqara-agent
aqara-agent is an official Aqara Home AI Agent skill. It supports natural-language home and space management, device inquiry, device control, device logs, scene management (query, execute, and logs), automation management (query, detail, toggle, and logs), and energy / electricity-cost statistics (by device, room, or home). Examples: \"How many lights are at home?\", \"Turn off the living room AC.\", \"What are the temperature and humidity in the bedroom?\", \"Run the Movie scene.\", \"What automations do I have?\", \"How much the electricity bill for the past month is at home?\", \"Check automation execution in the bedroom for the last three days.\"
git clone https://github.com/GeorgeDoors888/GB-Power-Market-JJ
T=$(mktemp -d) && git clone --depth=1 https://github.com/GeorgeDoors888/GB-Power-Market-JJ "$T" && mkdir -p ~/.claude/skills && cp -r "$T/openclaw-skills/skills/aqara/aqara-agent" ~/.claude/skills/georgedoors888-gb-power-market-jj-aqara-agent && rm -rf "$T"
T=$(mktemp -d) && git clone --depth=1 https://github.com/GeorgeDoors888/GB-Power-Market-JJ "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/openclaw-skills/skills/aqara/aqara-agent" ~/.openclaw/skills/georgedoors888-gb-power-market-jj-aqara-agent && rm -rf "$T"
openclaw-skills/skills/aqara/aqara-agent/SKILL.mdAqara Smart Home AI Agent Skill
Basics
- Host (default):
— override withagent.aqara.com
. Skill root:AQARA_OPEN_HOST
. Wrapper:skills/aqara-agent/
(scripts/aqara_open_api.py
→ Open Platform REST, including energy).AqaraOpenAPI
aqara_open_api.py
CLI
aqara_open_api.py- Invocation:
.python3 scripts/aqara_open_api.py <method_name> [json_body] - Must: first argument equals the exact public method name on
(see bash examples inAqaraOpenAPI
). Forbidden: aliases or shortened names unless a reference documents an equivalent.references/*.md - Dispatch:
→ no JSON body;get_*
→ JSON object (optional, defaultpost_*
).{} - Energy:
— route frompost_energy_consumption_statistic
only (non-empty → device API; else position). Fields and NL mapping:device_ids
.references/energy-statistic.md - Optional env:
(default 60),AQARA_OPEN_HTTP_TIMEOUT
.AQARA_OPEN_API_URL
Skill Package Layout
Relative to
skills/aqara-agent/. Normative: this file + references/*.md. README.md is a human index only.
| Path | Purpose |
|---|---|
| This document. |
| Human index; Forbidden treat as overriding . |
| Locales, , . |
| Template shape. |
| Live session (sensitive). |
| Per-domain procedures (account, home-space, devices, scenes, automations, energy). |
| CLI + HTTP client. |
| Writes . |
| Shared helpers. |
| Dependencies. |
Core Workflow
deps → sign-in → pick home → intent →
→ summarizereferences/*.md
Ground Truth (Binding)
Forbidden stating or implying as factual: homes, rooms, devices, capabilities, attributes, counts, logs, or control outcomes, except from executed skill scripts + real API responses or skill-accepted user input (e.g. pasted
aqara_api_key). If that flow has not succeeded, Forbidden any factual claim about those entities.
Forbidden demo-style lists, guessed layouts, synthetic values, fake success after errors/timeouts/missing auth, or prose/JSON mimicking API output without a real response.
Must state missing data and cause (e.g. not signed in, API error), then auth/retry/
references/. Forbidden imagined padding.
Execute in order:
1. Environment
export AQARA_OPEN_HOST=agent.aqara.com # test; omit or set prod host as required
cd skills/aqara-agent pip install -r scripts/requirements.txt
2. Auth
- Must confirm
readable/writable before features; host/project rules may require reading it first.user_account.json - Must follow
(switch-home vs re-login, token save, Step 1 login copy).references/aqara-account-manage.md - Must read
on every login guidance turn. Must set the user-facing login link to the exactassets/login_reply_prompt.json
string (official_open_login_url
). Forbidden invent Open Platform /login_url_policy
/sns-auth
/client_id
URLs from memory.redirect_uri - Locale from JSON for the user’s language; unknown →
(en
/fallback_locale
). Must deliver the single-line login URL perdefault_locale
.references/aqara-account-manage.md
user_account.json:
{ "aqara_api_key": "", "updated_at": "", "home_id": "", "home_name": "" }
3. Home Management
- Must after saving
runaqara_api_key
step 0 immediately (fetch homes; one home → write; many → user picks). Forbidden reply only “send home name” without running fetch.references/home-space-manage.md - Must run
andsave_user_account.py
as two separate invocations. Forbiddenaqara_open_api.py get_homes
on one shell line (&&
step 2,aqara-account-manage.md
step 0).home-space-manage.md - Switch home: Must re-fetch homes and let the user choose (
). Forbidden default to re-login. Must usehome-space-manage.md
login only if the user demands re-login/token rotation or the API signals expired/unauthorized.aqara-account-manage.md
4. Intent
Categories: space, device query, control, scene, automation, energy. Multiple intents: Must query before control, in utterance order.
| Intent | methods (details in reference) | Reference |
|---|---|---|
| Space | , | |
| Device query | , ; optional , | |
| Device control | | |
| Scene | , , , | |
| Automation | , , , | |
| Energy | | |
5. Route and Summarize
Must open the matching
references/ doc, run scripts, summarize from actual output only. Forbidden fabricate success or any home/room/device/state not in script/API output (Ground truth).
Illustrative CLI JSON (Agents Only)
Forbidden paste these raw blocks to end users.
REST shape (skeleton):
{ "code": 0, "message": "", "data": {} }
Bad params / parse error (skeleton):
{ "ok": false, "error": "..." }
Error Handling
| Situation | Action |
|---|---|
| Device not found | Must state no match; allowed: short candidate list. |
| Capability unsupported | Must state unsupported; Forbidden imply success. |
| Home/room not found | Must state no hit; Must direct next step via (re-fetch or verify home). |
| Multiple device matches | Must list matches; Must one disambiguation question (room or full name). |
Not signed in / empty | Must login + save per , then homes. → same. |
| No home selected | Must . No → ; one home → auto-write; many → . |
| Bad token / auth | Must re-login / refresh (no secret leak). Forbidden treat home switch as auth failure unless home-list returns auth error. (or equivalent) → Must re-login per ; Forbidden fake success. |
| Control path blocked | Must say device found, command not sent. |
| Other | Must short summary + retry/; Forbidden internal URLs or full headers. |
| Indeterminate | Must use + script output; confirmed bug → Must file skill issue. |
| Empty API data | Forbidden invent entities/readings; Must re-run or report failure (Ground truth). |
| HTTP / network | Forbidden treat as success; Must retry or brief explanation; Forbidden raw stacks. |
Notes
- Forbidden raw IDs in user text (device, position,
, …). Exception:home_id
allowed if server desensitized virtual ID.automation_id - After layout changes, if match fails: Must re-fetch space + devices (
,home-space-manage.md
), retry.devices-inquiry.md - User replies: Must conclusion first, then detail; Must ≤ one clarification question.
- Session gate: unsigned → Must end on setup; Forbidden imply control ran.
- Must run
automatically when required (stricter host policy wins).scripts/*.py - Account/home change: Must update
and re-runuser_account.json
.aqara-account-manage.md - Forbidden echo tokens/headers; Must treat
and caches as sensitive.user_account.json - Multiple fuzzy name hits: Must user confirm.
- User-visible: Forbidden shell, paths, raw stdout, debug JSON,
filenames; Must plain summary.references/ - Control OK: Must brief close; Forbidden preemptive hedging; fix only after user reports failure.
Out of Scope
Unsupported (no create/edit in this wrapper):
- Cameras — live / playback.
- Locks — unlock / lock-unlock.
- Scene authoring — only ops in
.references/scene-manage.md - Automation authoring — only ops in
.references/automation-manage.md - Shortcuts (e.g. Siri lists) — Must point to Aqara Home app.
- Weather — outside this API.
- Entertainment — beyond
.references/devices-control.md
When user asks for unsupported: Must say unsupported (or not yet); Must direct to Aqara Home app if the app covers it.