闲社服务运行正常AI智能体自动化平台
w

天气查询技能

技能标识:wttr-weather

How to check weather forecasts using wttr.in service. Make sure to use this skill whenever the user mentions weather, forecast, temperature, or wants to check weather conditions for any location. Supports 54+ languages, multiple output formats (terminal, JSON, PNG), moon phases, and custom locations worldwide.

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.0.0
检测标记
后台标记通过
免费
免费获取
0
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

天气查询技能

wttr.in 天气查询服务

💡 快捷工具:本 skill 包含辅助脚本和参考文档

  • - Python 脚本: scripts/weather.py - 多功能天气查询工具(统一使用)
  • 参考指南: references/quick-reference.md - 速查手册

核心功能

wttr.in 是一个功能强大的基于控制台天气预报服务,支持多种输出格式和全球位置查询。

主要能力

  1. 1. 天气预报查询 - 支持全球任意地点的天气预报
  2. 多格式输出 - ANSI 终端、HTML、PNG 图片、JSON、Prometheus 指标
  3. 多语言支持 - 54+ 种语言,包括中文
  4. 天文信息 - 月相、日出日落时间
  5. 自定义格式 - 灵活配置输出内容
  6. 一行输出 - 适合集成到 tmux、状态栏等

基本用法

标准查询(使用 Python 脚本)

bash

当前位置(基于 IP)


python scripts/weather.py

指定城市

python scripts/weather.py Beijing python scripts/weather.py Shanghai python scripts/weather.py New+York python scripts/weather.py London

使用 ~ 查询特殊地点(景点、山脉等)

python scripts/weather.py ~Eiffel+Tower python scripts/weather.py ~Mount+Everest

机场代码查询

python scripts/weather.py PEX # 北京首都机场 python scripts/weather.py PVG # 上海浦东机场 python scripts/weather.py LAX # 洛杉矶机场

单位设置

bash

公制单位(摄氏度,默认除美国外)


python scripts/weather.py Beijing -u m

英制单位(华氏度)

python scripts/weather.py Beijing -u u

公制 + m/s 风速

python scripts/weather.py Beijing -u M

输出格式

1. 终端 ANSI/纯文本

bash

标准输出(自动检测)


python scripts/weather.py Beijing

强制纯文本(无颜色)

python scripts/weather.py Beijing -f plain

限制为标准控制台字符

python scripts/weather.py Beijing -f compact

2. PNG 图片格式

bash

下载 PNG 天气图


python scripts/weather.py Beijing -f png -o weather.png

透明背景

python scripts/weather.py Beijing -f png --transparent -o weather.png

自定义透明度 (0-255)

python scripts/weather.py Beijing -f png --transparent --transparency 150

3. JSON 格式(API 使用)

bash

完整 JSON 数据


python scripts/weather.py Beijing -f json

精简 JSON(不含小时数据)

python scripts/weather.py Beijing -f json-lite

JSON 输出包含:

  • - current_condition: 当前天气状况
  • weather: 天气预报数据
  • astronomy: 天文信息(日出、日落、月相)

4. Prometheus 监控指标

bash

Prometheus 格式


python scripts/weather.py Beijing -f prometheus


一行输出格式(format 参数)

适合集成到 tmux、weechat、状态栏等。

预设格式

bash

格式 1: 当前天气


python scripts/weather.py Beijing -f oneline --custom-format 1

🌦 +11⁰C

格式 2: 详细信息

python scripts/weather.py Beijing -f oneline --custom-format 2

🌦 🌡️+11°C 🌬️↓4km/h

格式 3: 位置 + 天气

python scripts/weather.py Beijing -f oneline --custom-format 3

Beijing: 🌦 +11⁰C

格式 4: 完整信息

python scripts/weather.py Beijing -f oneline --custom-format 4

Beijing: 🌦 🌡️+11°C 🌬️↓4km/h

自定义格式(%-notation)

代码含义代码含义
%c天气状况图标%C天气状况文本
%x
天气符号(纯文本) | %h | 湿度 | | %t | 实际温度 | %f | 体感温度 | | %w | 风速和方向 | %l | 位置名称 | | %m | 月相 🌑🌒🌓🌔🌕🌖🌗🌘 | %M | 月龄 | | %p | 降水量 (mm/3h) | %P | 气压 (hPa) | | %u | UV 指数 (1-12) | %D | 黎明时间* | | %S | 日出时间 | %z | 天顶时间 | | %s | 日落时间 | %d | 黄昏时间 | | %T | 当前时间* | %Z | 本地时区 |

*时间以本地时区显示

bash

自定义输出示例


python scripts/weather.py Beijing --custom-format %l:+%c+%t+%h+%w\n

Beijing: ⛅️ +7°C 45% ↓12km/h

多地点查询

python scripts/weather.py Beijing:Shanghai:Guangzhou -f oneline --custom-format 3

数据丰富格式 (v2)

实验性功能,提供详细天气和天文信息。

bash

使用 v2 格式


python scripts/weather.py Beijing -f v2

使用 Nerd Fonts(日间模式)

python scripts/weather.py Beijing -f v2-day

使用 Nerd Fonts(夜间模式)

python scripts/weather.py Beijing -f v2-night

包含信息:

  • - 温度和降水变化预测
  • 月相(今天及未来 3 天)
  • 当前天气状况、温度、湿度、风速、气压
  • 时区信息
  • 黎明、日出、正午、日落、黄昏时间
  • 精确地理坐标



地图视图 (v3)

显示地理区域的天气信息。

bash

PNG 格式(浏览器)


python scripts/weather.py California -f v3

Sixel 格式(支持内联图像的终端)

python scripts/weather.py Bayern -f v3

月相查询

bash

当前位置月相


python scripts/weather.py -f moon

指定日期

python scripts/weather.py -f moon --moon-date 2025-12-25

作为天气查询的一部分

python scripts/weather.py Beijing --custom-format %m

🌖


多语言支持

bash

通过语言参数设置


python scripts/weather.py Beijing -l zh
python scripts/weather.py Paris -l fr
python scripts/weather.py Berlin -l de
python scripts/weather.py Tokyo -l ja

查询非英文名称位置

python scripts/weather.py станция+Восток python scripts/weather.py ~长城

支持 54+ 种语言,包括:zh(中文)、en(英语)、fr(法语)、de(德语)、ru(俄语)、ja(日语)等。



集成示例

tmux 状态栏

tmux

~/.tmux.conf


set -g status-interval 60

使用 Python 脚本查询天气


WEATHER=#(python /path/to/weather.py Beijing -f oneline --custom-format %%l:+%%c+%%t&period=60)
set -g status-right $WEATHER | %Y-%m-%d %H:%M

Shell 别名

bash

~/.bashrc 或 ~/.zshrc


alias weather=python /path/to/weather.py
alias weather-json=python /path/to/weather.py -f json

Python 程序集成

python
from weather import WeatherQuery

weather = WeatherQuery(Beijing)

获取 JSON 数据

data = weather.json_full() print(f当前温度:{data[currentcondition][0][tempC]}°C)

获取一行输出

print(weather.oneline(3))

使用建议

最佳实践

  1. 1. 自动查询场景(如 tmux)设置合理更新间隔(60-300 秒)
  2. 多地点查询 使用 : 分隔,配合 period 参数
  3. 脚本集成 使用 JSON 格式 (format=j1) 便于解析
  4. 终端显示

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 wttr-weather-1776283322 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 wttr-weather-1776283322 技能

通过命令行安装

skillhub install wttr-weather-1776283322

下载

⬇ 下载 wttr-weather v1.0.0(免费)

文件大小: 10.62 KB | 发布时间: 2026-4-17 16:36

v1.0.0 最新 2026-4-17 16:36
wttr-weather 1.0.0 – Initial release

- Provides an extensive guide on using the wttr.in weather service via a Python script.
- Supports global location queries, 54+ languages, flexible output formats (terminal, JSON, PNG, Prometheus), and moon phases.
- Documents advanced features: custom formatting, map views, detailed forecasts, and multi-location queries.
- Includes integration tips for tmux, shell aliases, and Python applications.
- Reference quick guide and troubleshooting included for convenience.
返回顶部