360 Secure SkillHub
360 安全技能中心

KnowAir Weather 明气天气

通过 Python 脚本调用彩云天气空气质量接口,按经纬度查询最长 15 天预报,返回 AQI 及 PM2.5、PM10、O3、NO2、SO2、CO 数值,并给出趋势分析、最佳/最差时段与健康建议。运行需 CAIYUN_TOKEN 与联网环境。

shuowang-ai
shuowang-ai
热度 51.03
最近更新 2026-05-11 17:30:57
分类:生活依赖:代码执行 / 第三方 API / 读写文件应用场景:健康 / 报告撰写

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add knowair-weather
Metadata
name
knowair-air-quality
description
Get comprehensive air quality forecast from monitoring stations with up to 15-day coverage via the Caiyun Weather API. Returns AQI, PM2.5, PM10, O3, NO2, SO2, CO values with trend analysis, best/worst periods, and health recommendations. Use when the user asks about air quality, AQI, PM2.5, pollution forecast, smog, air pollution, or is it safe to exercise outdoors.
license
MIT-0
compatibility
Requires python3 and internet access.
argument-hint
For example: check air quality at 116.3176,39.9760, or air quality forecast for Shanghai
allowed-tools
["Bash(python3:*)","Read"]
metadata
{"openclaw":{"emoji":"💨","primaryEnv":"CAIYUN_TOKEN","requires":{"env":["CAIYUN_TOKEN"],"bins":["python3"]}}}

KnowAir Air Quality — Station-Based AQI Forecast

Query comprehensive air quality forecasts from monitoring stations with up to 15-day coverage using the Caiyun Weather API.

Prerequisites

  1. A valid Caiyun Weather API token set as CAIYUN_TOKEN environment variable, or stored in ~/.config/knowair/token.
  2. Coordinates (longitude, latitude) for the target location.

Quick Start

python3 scripts/query_air_quality.py --lng 116.3176 --lat 39.9760

Workflow

  1. Resolve coordinates — convert city name to coordinates if needed.
  2. Run the script:
    python3 scripts/query_air_quality.py --lng <LNG> --lat <LAT>
    
  3. Present results — summarize current AQI level, pollutant trends, best/worst periods, and health advice.

Options

Flag Description Default
--lng Longitude (-180 to 180) Required
--lat Latitude (-90 to 90) Required
--hours Forecast hours (1-360) 120
--detail-level Display density 0-6 (0=auto) 0
--lang Output language: en or zh en

Defaults

  • Hours: 120 (5 days)
  • Detail level: auto (0)
  • Language: en

Failure Handling

  • Missing token → exit code 2 with setup instructions.
  • API error → exit code 1 with error details.
  • Station data unavailable → falls back to API forecast data.