codecamp

OpenClaw Skills 天气工具(weather)

天气(weather)

一款极简、快速、无广告的命令行天气查询工具,无需 API 密钥、无需登录,开箱即用。

支持:当前天气、未来小时预报、未来天预报、降水概率、风速、湿度、体感温度、日出日落。

👤 作者:Peter Steinberger
👉 Skills 下载地址:weather-1.0.0.zip

安装

## 使用 Homebrew 安装天气命令行工具
brew install steipete/tap/weather

基础使用

1. 查询当前天气(自动定位)

## 自动获取你当前位置的实时天气
weather

2. 查询指定城市天气

## 查询北京天气
weather beijing


## 查询上海天气
weather shanghai


## 查询国外城市
weather london
weather tokyo

3. 查看完整预报

## 查看未来几天完整天气预报(含温度、降水、风速)
weather forecast


## 查看指定城市完整预报
weather forecast guangzhou

4. 查看未来几小时预报

## 查看未来 24 小时逐小时预报
weather hourly


## 指定城市小时预报
weather hourly shenzhen

高级用法(全中文注释)

显示温度单位切换

## 以 摄氏度(°C) 显示
weather --c


## 以 华氏度(°F) 显示
weather --f

精简输出 / 详细输出

## 极简输出(仅温度+天气)
weather --short


## 完整输出(湿度、气压、能见度、露点)
weather --full

显示日出日落 / 风向风速

## 显示日出日落时间
weather --sun


## 显示风速、风向
weather --wind

显示降水概率

## 显示降雨/降雪概率
weather --rain

组合使用

## 北京 + 摄氏度 + 完整信息 + 风速
weather beijing --c --full --wind

常用命令速查表

命令 作用
weather 当前天气(自动定位)
weather 城市名 查询指定城市
weather forecast 多天预报
weather hourly 小时级预报
weather --c 摄氏度
weather --f 华氏度
weather --short 精简显示
weather --full 完整详情
weather --wind 显示风速
weather --rain 显示降水概率
weather --sun 日出日落

配置(可选)

你可以创建配置文件,设置默认城市、默认单位

## 创建配置目录
mkdir -p ~/.config/weather


## 写入默认配置:默认城市北京,默认摄氏度
echo 'location = "Beijing"' > ~/.config/weather/config
echo 'unit = "c"' >> ~/.config/weather/config

工具特点

✅ 开箱即用,无需 API 密钥
✅ 自动定位,无需手动输入城市
✅ 支持全球城市
✅ 摄氏度 / 华氏度自由切换
✅ 纯命令行,轻量无依赖
✅ 支持预报、降水、风速、湿度、体感温度

官方信息

  • 技能地址:https://clawhub.ai/steipete/weather
  • 适用平台:macOS / Linux
  • 安装命令:brew install steipete/tap/weather

操作指南

提供两种免费的天气查询服务,均无需API密钥。

wttr.in(首选服务)

简洁单行查询

## 查询伦敦天气(简洁格式)
## 输出示例:London: ⛅️ +8°C
curl -s "wttr.in/London?format=3"

详细紧凑格式查询

## 查询伦敦天气(包含温度、湿度、风速)
## 输出示例:London: ⛅️ +8°C 71% ↙5km/h
curl -s "wttr.in/London?format=%l:+%c+%t+%h+%w"

完整天气预报查询

## 查询伦敦完整天气预报(隐藏终端配色)
curl -s "wttr.in/London?T"

格式码说明

%c 天气状况 · %t 温度 · %h 湿度 · %w 风速 · %l 地理位置 · %m 月相

使用小贴士

  • 含空格的城市名需URL编码:wttr.in/New+York(纽约)
  • 支持机场代码:wttr.in/JFK(纽约肯尼迪机场)
  • 单位切换:?m(公制,默认) ?u(美制)
  • 时间范围:?1 仅今日 · ?0 仅当前时段
  • 导出PNG图片:curl -s "wttr.in/Berlin.png" -o /tmp/weather.png(将柏林天气图片保存到/tmp目录)

Open-Meteo(备用服务,返回JSON)

免费、无需密钥,适合编程场景调用:

## 查询伦敦坐标(纬度51.5,经度-0.12)的实时天气
## 返回JSON格式数据,包含温度、风速、天气编码等
curl -s "https://api.open-meteo.com/v1/forecast?latitude=51.5&longitude=-0.12¤t_weather=true"

使用说明

先查询目标城市的经纬度坐标,再传入接口查询。返回的JSON数据包含温度、风速、天气编码等字段。

官方文档:https://open-meteo.com/en/docs

OpenClaw Skills Agent Browser(浏览器自动化工具)
OpenClaw Skills 主动式智能体(Proactive Agent)
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }