Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/allocnode/oh-my-sage/mijia-automationnpx skills add allocnode/oh-my-sage --skill mijia-automationgit clone --depth 1 https://github.com/allocnode/oh-my-sageWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/allocnode/oh-my-sage/mijia-automation)<a href="https://agentmods.dev/skills/allocnode/oh-my-sage/mijia-automation"><img src="https://agentmods.dev/badge/skills/allocnode/oh-my-sage/mijia-automation.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00055 | $0.06635 |
| Opus 5 | $0.00028 | $0.03318 |
| Sonnet 5 | $0.00011 | $0.01327 |
| Haiku 4.5 | $0.00006 | $0.00664 |
Grade A, and why
mijia-automation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 378 lines — stays where its author put it; the contents beside it link to each section on GitHub.
米家自动化规则创建
设计新自动化时的知识检索
不要一开始就堆节点。先把需求拆成:触发、状态、变换、条件、动作、退出、恢复,再读取 知识索引 中最相关的一至三个模式文件。
快速选择模式:
| 问题 | 模式 |
|---|---|
| 需要跨事件记住值、模式或时间点 | PAT-STATE-01 |
| 需要计算、映射、取整、量化或夹紧 | PAT-NUM-01 |
| 需要多源汇总、任一/全部或至少 k 个 | PAT-AGG-01 |
| 需要日期、时长、时间窗口或节律 | PAT-TIME-01 |
| 需要重复执行、停止、清零或恢复 | PAT-LOOP-01 |
| 需要设备跟随、双向同步或按实际状态切档 | PAT-SYNC-01 |
| 需要跨设备型号、跨规则、模板或虚拟事件 | PAT-ADAPT-01 |
常见组合:节律照明 = TIME + NUM + LOOP;外部可改档设备 = STATE + SYNC;重复提醒 = STATE + LOOP + ADAPT。
模式用于选择结构和发现风险,不是固定模板。组合模式后仍须根据目标设备 MIOT Spec 重新确定 DID、URN、字段、量程、步进、枚举和动作参数。不得照抄案例中的设备、阈值、变量名或私有标识。
案例知识按以下状态升级:
video → ui-sample → graph-diff → local-tested → gateway-roundtrip → runtime-verified → reusable-pattern
视频案例只是设计线索。未达到 runtime-verified 的行为不得写成强制校验规则;达到 reusable-pattern 还必须满足脱敏、跨场景适用和边界明确,才可作为通用模式推荐。证据可从真实规则、源码或网关样本开始,不要求机械经过每一级。
完整节点字段按需读取 米家自动化规则完全参考,不要把全部节点模板和全部案例同时加载。
变量生命周期能力
变量管理分为三层,不能把其中一层的限制误判成网关不支持:
| 层级 | 能力与限制 |
|---|---|
| 网关 API | 支持 createVar、deleteVar、getVarValue、getVarConfig、setVarValue |
| 专用 MCP 工具 | 使用 mijia_create_variable、mijia_delete_variable、mijia_get_variable_value、mijia_get_variable_config、mijia_set_variable |
| 通用原始 API 工具 | mijia_call_api 故意只允许只读方法;写方法被拒绝不代表网关没有写能力 |
关键规则:
- 新建变量必须调用
mijia_create_variable;mijia_set_variable只修改已存在变量,不会自动创建。 varSetNumber、varSetString、deviceInputSetVar和deviceGetSetVar只写已存在变量,不能用作变量创建器。- 变量 ID 必须匹配
^[a-zA-Z0-9]+$,不能含下划线、连字符或中文;显示名称name可以包含中文。 type只能是number或string,初始值和后续值必须与类型一致。createVar的显示名称必须放在userData: { name },不能传顶层name。缺少userData.name时变量虽可按 ID 读取,但极客版 UI 的变量选择器不会显示它。- 删除变量前检查所有规则引用;删除是不可恢复操作。
本规则变量的作用域名与创建时机
- 作用域名 =
R+ 规则 ID 的数字部分,去掉graph_前缀。例:规则graph_1700000000000→ 作用域R1700000000000;规则1700000000000→R1700000000000。可用mijia_call_api getVarScopeList核对。 - 节点里写
"scope": "rule"的自动替换只发生在mijia_create_graph和mijia_graph_draft_begin(经由variables参数)。 mijia_update_graph没有variables参数。给已有规则新增变量时,必须先单独调用mijia_create_variable并显式传真实作用域字符串,节点里也要写真实作用域,不能写"rule"。
What ships with it
13 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- references/cases/catalog.md 3.1 KB
- references/experiments/index.md 3.5 KB
- references/gateway-capability-discovery.md 3.7 KB
- references/index.md 2.6 KB
- references/lessons-learned.md 7.1 KB
- references/mijia-complete-reference.md 43 KB
- references/patterns/adapters-and-templates.md 3.9 KB
- references/patterns/aggregation-and-thresholds.md 3.0 KB
- references/patterns/loops-and-lifecycle.md 2.4 KB
- references/patterns/numeric-transforms.md 1.7 KB
- references/patterns/state-and-scope.md 3.9 KB
- references/patterns/synchronization.md 3.1 KB
- references/patterns/time-and-duration.md 2.7 KB
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 6d ago First seen · 378 lines · 55 tokens per session scan A 63d6f38d154d
mijia-automation is a skill published in the GitHub repository allocnode/oh-my-sage (78 stars, last pushed 11d ago), licensed MIT. It adds 55 tokens to every session and 6,635 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
integrated-browser
Use this when working on the VS Code integrated browser ("browserView") to understand its architecture and mental model. Covers the embedded Chromium browser, its editor tab, navigation, overlay/layout, sessions, and agent browser tools under src/vs/platform/browserView and src/vs/workbench/contrib/browserView.
gke-compute-classes
Configures, optimizes, and troubleshoots GKE ComputeClasses. Use when configuring Spot VMs with on-demand fallback, targeting specific accelerators (GPUs/TPUs) or machine families, restricting ComputeClass access, or debugging pending pods related to node pool auto-creation. Do not use for cluster-level Node Auto…
jetson-diagnostic
Read-only Jetson health snapshot for identity, memory, GPU, thermal, power, storage, services, and top processes.
doca-socket-relay
Use this skill when the operator is driving the DOCA Socket Relay to bridge a socket-oriented host application onto a BlueField DPU peer without rewriting it — picking the deployment shape (in-process, sidecar, or BlueField service container), configuring the host-side socket and the DPU-side forwarding endpoint…
offensive-z-wave
Z-Wave attack methodology — sniffing with Z-Force / EZ-Wave / RTL-SDR + ZniffMobile, S0 (legacy) network-key derivation flaw and key reuse, S2 (modern) ECDH commissioning analysis, replay/injection on unauthenticated nodes, default-key brute-force on test deployments, and home-automation hub pivots. Use when targeting…
hsb-flash
Flash the FPGA on an HSB board connected to an NVIDIA devkit. Supports HSB Lattice boards (FPGA versions 2407, 2412, 2507, 2510) and Leopard Imaging VB1940 "all-in-one" cameras (FPGA versions 2507, 2510). Uses release-specific YAML manifests and board-type-specific program commands. Lattice and VB1940 commands must…