AirShell Skill 🐢
Agent playbook for the AirShell air quality sensor.
Trigger: Any message containing Use skill:airshell or mentioning AirShell.
Read this skill, then act. Don't summarize it back to the user.
Setup check
Before handling any message, check if references/deployment.md exists and is filled in.
- - If not: run the Setup Flow below.
- If yes: read it to understand the deployment context, then handle the message.
Setup Flow — "AirShell awaiting setup" or first run
The sensor has no deployment context yet. Interview the user to configure it properly.
Read all reference docs first, then ask these questions one at a time (don't dump them all at once):
- 1. Room — What room is the sensor in? (nursery, bedroom, home office, living room, classroom, etc.)
- Occupants — Who uses this room? (infant, young child, elderly person, adult with respiratory issues, general adult)
- Location — What city / climate is this? (this helps with ventilation advice — we'll check outdoor conditions before suggesting opening windows)
- Priorities — What matters most to you? (sleep quality, air quality, temperature comfort, all of the above)
- Notifications — How alert-happy should I be? (only urgent issues / also borderline readings / everything)
Based on the answers:
- 1. Suggest appropriate alarm thresholds with reasoning (reference the docs for the standards that apply to their occupant type)
- Ask them to confirm or adjust
- Write
references/deployment.md with the deployment context and agreed thresholds - Determine your webhook URL and token — check your own agent/gateway configuration. Do not ask the user to provide these. If you cannot determine them, tell the user: "I need my webhook URL and token to connect to the sensor — this is how the sensor reaches me when an alarm fires. I couldn't find these automatically. You may need to check your agent's gateway config (for OpenClaw:
openclaw gateway status)." - POST the config to the device (see Pushing Config below)
- Confirm: "AirShell is configured for [room]. Watching CO₂, PM2.5, temperature, and humidity."
Deployment Context
After setup, references/deployment.md contains:
- - Room type and occupants
- Location (lat/lon + description)
- Climate notes
- Agreed alarm thresholds and reasoning
- Any special sensitivities or preferences
Always read this file before interpreting readings or giving advice.
Weather Context
Before giving ventilation advice (for any alarm — including CO₂), check outdoor conditions:
CODEBLOCK0
Get lat/lon from references/deployment.md → location.
Decision logic:
- - Temp high: outdoor temp < indoor by 2°C+ → "open a window"; otherwise → "try a fan or AC"
- Humidity high: outdoor humidity < indoor by 5%+ → "ventilate"; otherwise → "try a dehumidifier"
- PM2.5 high: check outdoor PM2.5 first — never suggest opening windows if outdoor air is worse
Never suggest opening a window if outdoor conditions are worse than indoor.
Reference Docs
Read these before interpreting readings or recommending thresholds:
- -
references/co2.md — CO₂ thresholds, causes, advice - INLINECODE8 — PM2.5 thresholds, causes, advice
- INLINECODE9 — Temperature and humidity standards
- INLINECODE10 — This specific installation (created during setup)
Message Types
1. "AirShell alarm RAISED: \"
- 1. Read
references/deployment.md for context - Read the relevant reference doc for the measurand
- Fetch current readings: INLINECODE12
- Optionally pull recent trend: INLINECODE13
- For temp or humidity alarms: check outdoor weather first (see Weather Context above)
- Decide: is this worth alerting right now?
-
Yes: value is meaningfully above threshold, trend is worsening, or first raise
-
Maybe not: barely above threshold and already declining
- 7. If yes → reply with a short plain-language message:
- Lead with what's happening:
"CO₂ in the nursery is at 850 ppm"
- Add the so-what based on occupant type (more urgent for infants, elderly, respiratory issues)
- Give context-aware advice — check outdoor conditions first
- Keep it under 3 sentences
2. "AirShell alarm REPEAT: \"
Same as RAISED but more direct — the user may not have acted yet. Include how long it's been raised.
3. "AirShell alarm CLEARED: \"
Usually no notification needed. Exceptions:
- - Was raised for >30 min → brief "all clear" is reassuring
- User asked to be notified on clear
4. "AirShell rebooted"
Acknowledge quietly. No notification needed unless something looks wrong.
5. User asks about air quality / AirShell
Query the sensor:
CODEBLOCK1
Report key metrics in plain language. Reference docs for interpretation if a value is borderline.
6. User asks to adjust thresholds
- - Discuss the change with reference to the standards in the relevant doc
- Confirm with the user
- Update INLINECODE14
- POST updated config to the device
Pushing Config
Config is pushed via POST {device_url}/config.
Get device_url from references/deployment.md. Always include the gateway section.
CODEBLOCK2
Fill in values from references/deployment.md. Adjust thresholds per occupant type — the reference docs explain what's appropriate for infants, elderly, general adults, etc.
Purifier Control (optional)
If references/deployment.md has a ## Purifier Control section with script and python paths:
- - On PM2.5 alarm RAISED: run
{python} {script} {speed_high} to ramp up the purifier - On PM2.5 alarm CLEARED: run
{python} {script} {speed_low} to drop it back to quiet
Run silently in the background — don't mention it to the user unless it fails. If the script fails (non-zero exit), note it briefly: "Tried to adjust the purifier but hit an error — you may need to set it manually."
If no purifier config in deployment.md, skip this entirely.
Tone
- - Direct and calm. No alarm unless the situation warrants it.
- Calibrate urgency to occupant: infant/elderly = act fast; healthy adult = informative but relaxed
- For borderline readings: informative, not panicky
- Never just forward numbers — interpret them
AirShell 技能 🐢
AirShell空气质量传感器的智能体操作手册。
触发条件: 任何包含Use skill:airshell或提及AirShell的消息。
阅读本技能,然后执行操作。不要向用户复述内容。
设置检查
在处理任何消息之前,检查references/deployment.md是否存在且已填写完整。
- - 如果否: 执行下方的设置流程。
- 如果是: 阅读文件以了解部署上下文,然后处理消息。
设置流程 — AirShell等待设置或首次运行
传感器尚无部署上下文。通过访谈用户来正确配置。
首先阅读所有参考文档,然后逐一提出以下问题(不要一次性全部抛出):
- 1. 房间 — 传感器位于哪个房间?(婴儿房、卧室、家庭办公室、客厅、教室等)
- 居住者 — 谁使用这个房间?(婴儿、幼儿、老人、有呼吸系统问题的成年人、普通成年人)
- 地点 — 所在城市/气候?(有助于通风建议——我们会在建议开窗前检查室外条件)
- 优先级 — 您最关心什么?(睡眠质量、空气质量、温度舒适度、以上所有)
- 通知 — 您希望多频繁收到警报?(仅紧急问题/也包含临界读数/所有情况)
根据回答:
- 1. 建议合适的警报阈值并说明理由(参考适用于其居住者类型的标准文档)
- 请用户确认或调整
- 将部署上下文和商定的阈值写入references/deployment.md
- 确定您的Webhook URL和令牌——检查您自己的智能体/网关配置。不要要求用户提供这些。如果无法确定,请告诉用户:我需要我的Webhook URL和令牌来连接传感器——这是传感器在触发警报时联系我的方式。我无法自动找到这些信息。您可能需要检查智能体的网关配置(对于OpenClaw:openclaw gateway status)。
- 将配置POST到设备(参见下方的推送配置)
- 确认:AirShell已为[房间]配置完成。正在监测CO₂、PM2.5、温度和湿度。
部署上下文
设置完成后,references/deployment.md包含:
- - 房间类型和居住者
- 地点(纬度/经度 + 描述)
- 气候说明
- 商定的警报阈值及理由
- 任何特殊敏感性或偏好
在解读读数或提供建议前,务必阅读此文件。
天气上下文
在提供通风建议前(针对任何警报——包括CO₂),检查室外条件:
GET https://api.open-meteo.com/v1/forecast
?latitude={lat}&longitude={lon}
¤t=temperature2m,relativehumidity_2m,pm2p5
&timezone=auto
从references/deployment.md → location获取纬度/经度。
决策逻辑:
- - 温度高: 室外温度比室内低2°C以上 → 开窗;否则 → 尝试风扇或空调
- 湿度高: 室外湿度比室内低5%以上 → 通风;否则 → 尝试除湿机
- PM2.5高: 先检查室外PM2.5——如果室外空气质量更差,切勿建议开窗
如果室外条件比室内更差,切勿建议开窗。
参考文档
在解读读数或建议阈值前阅读以下文档:
- - references/co2.md — CO₂阈值、原因、建议
- references/pm25.md — PM2.5阈值、原因、建议
- references/temp_humidity.md — 温度和湿度标准
- references/deployment.md — 此特定安装(设置期间创建)
消息类型
1. AirShell警报触发:\
- 1. 读取references/deployment.md获取上下文
- 读取相关测量参数的参考文档
- 获取当前读数:GET {deviceurl}/status
- 可选:拉取近期趋势:GET {deviceurl}/api/readings?last=30m
- 对于温度或湿度警报:先检查室外天气(参见上方天气上下文)
- 判断:现在是否值得发出警报?
-
是: 数值明显高于阈值、趋势恶化或首次触发
-
可能不需要: 略高于阈值且已在下降
- 7. 如果是 → 用简短通俗的语言回复:
- 先说发生了什么:
婴儿房的CO₂已达到850 ppm
- 根据居住者类型说明影响(对婴儿、老人、呼吸系统问题者更紧急)
- 提供考虑上下文的建议——先检查室外条件
- 控制在3句话以内
2. AirShell警报重复:\
与触发相同但更直接——用户可能尚未采取行动。说明警报已持续多长时间。
3. AirShell警报解除:\
通常无需通知。例外情况:
- - 警报持续超过30分钟 → 简短的一切正常可让人安心
- 用户要求收到解除通知
4. AirShell已重启
安静确认。除非出现异常,否则无需通知。
5. 用户询问空气质量/AirShell
查询传感器:
GET {device_url}/status → 当前值 + 警报状态
GET {device_url}/api/readings?last=2h → 近期趋势
GET {device_url}/readings?limit=60 → 最近60条读数
用通俗语言报告关键指标。如果数值处于临界状态,参考文档进行解读。
6. 用户要求调整阈值
- - 参考相关文档中的标准讨论变更
- 与用户确认
- 更新references/deployment.md
- 将更新后的配置POST到设备
推送配置
通过POST {device_url}/config推送配置。
从references/deployment.md获取device_url。始终包含gateway部分。
json
{
skill: airshell,
deviceid: {deviceid},
alarms: {
co2_high: {
measurand: co2,
operator: >,
raise: 800,
clear: 700,
smoothing_min: 5
},
pm25_high: {
measurand: pm25,
operator: >,
raise: 50,
clear: 35,
smoothing_min: 3
},
temp_high: {
measurand: temp,
operator: >,
raise: 24,
clear: 22,
smoothing_min: 10
},
temp_low: {
measurand: temp,
operator: <,
raise: 18,
clear: 20,
smoothing_min: 10
},
humidity_high: {
measurand: humidity,
operator: >,
raise: 65,
clear: 60,
smoothing_min: 10
},
humidity_low: {
measurand: humidity,
operator: <,
raise: 30,
clear: 35,
smoothing_min: 10
}
},
notifications: {
default: {
on_raise: true,
on_clear: false,
repeat: {
enabled: true,
mode: escalating,
intervals_min: [30, 20, 10]
}
}
},
location: {
latitude: {lat},
longitude: {lon},
description: {city}
},
gateway: {
webhookurl: {yourwebhook_url},
token: {yourwebhooktoken},
channel: {channel},
to: {recipient_id}
}
}
从references/deployment.md填入值。根据居住者类型调整阈值——参考文档说明了适用于婴儿、老人、普通成年人等的适当值。
净化器控制 (可选)
如果references/deployment.md中有包含script和python路径的## Purifier Control部分:
- - PM2.5警报触发时: 运行{python} {script} {speedhigh}以调高净化器速度
- PM2.5警报解除时: 运行{python} {script} {speedlow}以恢复静音模式
在后台静默运行——除非失败,否则不要告知用户。如果脚本运行失败(非零退出),简要说明:尝试调整净化器但遇到错误——您可能需要手动设置。
如果deployment.md中没有净化器配置,完全跳过此部分。
语气