mijia-automation

mijia-automation is a skill for Claude Code, Codex from allocnode/oh-my-sage. It costs 55 tokens per session (6,635 once invoked), scanned A, original, MIT.

A guide for designing Xiaomi Mi Home automation rules by separating triggers, stored state, transformations, conditions, actions, stopping rules, and recovery.

In plain words
What is it for?
It helps plan automations involving remembered values, calculations, time windows, repetition, device synchronization, multiple devices, templates, and virtual events.
Why use it?
It prevents complex automations from being assembled blindly and highlights where device differences, unsupported behavior, or weak evidence may cause problems.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Install

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.

agentmods
npx agentmods add skills/allocnode/oh-my-sage/mijia-automation
Any agent
npx skills add allocnode/oh-my-sage --skill mijia-automation
Clone the repo
git clone --depth 1 https://github.com/allocnode/oh-my-sage

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for mijia-automation

README.md
[![agentmods](https://agentmods.dev/badge/skills/allocnode/oh-my-sage/mijia-automation.svg)](https://agentmods.dev/skills/allocnode/oh-my-sage/mijia-automation)
Your own site
<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>
Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,635 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 6d ago against content hash 63d6f38d154d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

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.

.agents/skills/mijia-automation/SKILL.md · 378 lines

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 支持 createVardeleteVargetVarValuegetVarConfigsetVarValue
专用 MCP 工具 使用 mijia_create_variablemijia_delete_variablemijia_get_variable_valuemijia_get_variable_configmijia_set_variable
通用原始 API 工具 mijia_call_api 故意只允许只读方法;写方法被拒绝不代表网关没有写能力

关键规则:

  • 新建变量必须调用 mijia_create_variablemijia_set_variable 只修改已存在变量,不会自动创建。
  • varSetNumbervarSetStringdeviceInputSetVardeviceGetSetVar 只写已存在变量,不能用作变量创建器。
  • 变量 ID 必须匹配 ^[a-zA-Z0-9]+$,不能含下划线、连字符或中文;显示名称 name 可以包含中文。
  • type 只能是 numberstring,初始值和后续值必须与类型一致。
  • createVar 的显示名称必须放在 userData: { name },不能传顶层 name。缺少 userData.name 时变量虽可按 ID 读取,但极客版 UI 的变量选择器不会显示它。
  • 删除变量前检查所有规则引用;删除是不可恢复操作。

本规则变量的作用域名与创建时机

  • 作用域名 = R + 规则 ID 的数字部分,去掉 graph_ 前缀。例:规则 graph_1700000000000 → 作用域 R1700000000000;规则 1700000000000R1700000000000。可用 mijia_call_api getVarScopeList 核对。
  • 节点里写 "scope": "rule" 的自动替换只发生在 mijia_create_graphmijia_graph_draft_begin(经由 variables 参数)。
  • mijia_update_graph 没有 variables 参数。给已有规则新增变量时,必须先单独调用 mijia_create_variable 并显式传真实作用域字符串,节点里也要写真实作用域,不能写 "rule"

Read the full file on GitHub · 378 lines

Changes

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.

  1. 6d ago First seen · 378 lines · 55 tokens per session scan A 63d6f38d154d

Subscribe to this mod's changes

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.

Related

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.

microsoft/vscode · 68 tokens

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…

google/skills · 83 tokens

jetson-diagnostic

Read-only Jetson health snapshot for identity, memory, GPU, thermal, power, storage, services, and top processes.

NVIDIA/skills · 30 tokens

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…

NVIDIA/skills · 236 tokens

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…

SnailSploit/Claude-Red · 113 tokens

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…

NVIDIA/skills · 94 tokens