weather-alert
SKILL.md
天气提醒 Skill - POPO 版
自动检查明天的天气情况,异常情况会推送到 POPO。
快速使用
手动测试
python3 ~/.openclaw/workspace/skills/weather-alert/check_weather.py
查看定时任务
openclaw cron list | grep weather
手动触发定时任务
openclaw cron run <job-id>
功能说明
触发条件
以下情况会触发提醒:
- 🌧️ 下雨:降水概率 > 50%
- 🥶 大降温:温度下降 ≥ 5°C
- 🥵 大升温:温度上升 ≥ 5°C
定时任务配置
- 名称:weather-alert
- 时间:每天 20:00(晚上8点)
- 时区:Asia/Shanghai
- 位置:杭州 (30.2741, 120.1551)
- 推送渠道:POPO
- 接收人:nizewei01@corp.netease.com
数据源
使用 Open-Meteo API:
- ✅ 免费无需 API key
- ✅ 可靠稳定
- ✅ 全球覆盖
- 数据:温度(最高/最低)、降水概率
示例输出
有异常时
🌤️ 天气提醒 (03月10日)
🌧️ 明天有雨!降水概率 75%
📊 明天:15°C ~ 18°C
📅 今天:12°C ~ 20°C
正常时
明天天气正常
自定义配置
修改城市
编辑 config.json:
{
"city": "上海",
"latitude": 31.2304,
"longitude": 121.4737
}
支持的城市:
- 杭州:30.2741, 120.1551
- 上海:31.2304, 121.4737
- 北京:39.9042, 116.4074
- 深圳:22.5431, 114.0579
- 广州:23.1291, 113.2644
- 成都:30.5728, 104.0668
修改推送接收人
编辑 config.json:
{
"message": {
"receiver": "your-email@corp.netease.com"
}
}
修改触发阈值
编辑 config.json:
{
"thresholds": {
"rain_probability": 50,
"temp_drop": 5,
"temp_rise": 5
}
}
修改推送时间
# 改成每天早上 7 点
openclaw cron edit <job-id> --cron "0 7 * * *"
# 改成每天中午 12 点
openclaw cron edit <job-id> --cron "0 12 * * *"
设置定时任务
方法1:使用 OpenClaw Cron
openclaw cron add --name weather-alert --schedule "0 20 * * *" \
--message "检查明天天气"
方法2:使用系统 Crontab
# 编辑 crontab
crontab -e
# 添加以下行(每天晚上 8 点检查)
0 20 * * * python3 ~/.openclaw/workspace/skills/weather-alert/check_weather.py
扩展功能
可以在 check_weather.py 中添加:
- 🌪️ 大风提醒(风速 > 某阈值)
- 🌫️ 空气质量提醒
- ☀️ 紫外线指数提醒
- 🌡️ 体感温度提醒
- 📅 多日预报(未来 3 天)
故障排除
收不到推送?
- 检查定时任务状态:
openclaw cron list - 查看执行日志:
openclaw cron runs --id <job-id> - 手动测试脚本是否正常
- 检查 POPO 配置是否正确
天气数据不准?
- Open-Meteo 更新频率:每小时
- 坐标精度:小数点后 4 位
- 可对比其他天气源验证
技术细节
- API:Open-Meteo (https://open-meteo.com)
- 超时:15 秒
- 推送:通过 OpenClaw message 工具 → POPO
- 调度:OpenClaw cron system
- 语言:Python 3
更新日志
2026-03-23
- ✅ 适配 POPO 推送
- ✅ 更新配置文件
- ✅ 更新 SKILL.md 文档