Google Weather: 全球实时天气数据与预报 - Openclaw Skills

作者:互联网

2026-03-25

AI教程

什么是 Google Weather?

此技能通过利用 Google Weather 和 Geocoding API 的强大功能,使您的 AI 代理能够访问实时、超本地的天气数据。它提供全面的气象细节,包括当前状况、温度、湿度和风速,每 15 分钟更新一次以确保最高准确度。通过将其集成到 Openclaw Skills 中,开发人员可以创建上下文感知代理,以响应环境变化或协助用户进行日常规划。

除了基础的温度查询,该技能还支持全球地点查找,范围从主要城市到特定的地标或坐标。它能够返回易于阅读的格式化文本和原始 JSON 数据,这使其成为简单报告和复杂数据驱动自动化的通用工具。

下载入口:https://github.com/openclaw/skills/tree/main/skills/shaharsha/google-weather

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install google-weather

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 google-weather。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

Google Weather 应用场景

  • 为全球旅行或物流实时监控当前天气状况。
  • 生成自动化的 24 小时天气预报,用于安排户外活动。
  • 将超本地气候数据集成到生产力仪表板或智能家居例程中。
  • 为 Openclaw Skills 内部的归档或分析目的获取结构化 JSON 天气数据。
Google Weather 工作原理
  1. 用户提供位置输入,例如城市名称、地址或地标。
  2. 技能使用 Google Geocoding API 将位置字符串转换为地理坐标。
  3. 向 Google Weather API 发送请求以检索当前状况或每小时预报数据。
  4. weather_helper.py 脚本处理 API 响应,处理单位转换和表情符号格式化。
  5. 最终输出以请求的格式(文本、预报或原始 JSON)交付给代理。

Google Weather 配置指南

  1. 在 Google Cloud Console 中创建一个新项目。
  2. 在 API 库中启用 Weather APIGeocoding API
  3. 在凭据部分创建一个 API 密钥。
  4. 设置环境变量以验证技能:
export GOOGLE_API_KEY='your_google_api_key_here'
  1. 通过运行当前天气检查来验证安装:
python3 skills/google-weather/lib/weather_helper.py current "London"

Google Weather 数据架构与分类体系

该技能根据以下分类组织并返回天气数据:

属性 详情
温度 当前摄氏度和“体感”数值。
状况 视觉描述(例如晴朗、雨天)及对应的表情符号。
预报 包含温度、风力和天空状况的 24 小时每小时板块。
大气 湿度百分比、紫外线指数和云量。
风力 风速 (km/h)、方向和阵风信息。
降水 降雨或降雪的概率和类型。
name: google-weather
description: Google Weather API - accurate, real-time weather data. Get current conditions, temperature, humidity, wind, and forecasts. Powered by Google's Weather API for reliable, hyperlocal data updated every 15 minutes. Supports any location worldwide.
version: 1.2.0
author: Leo ??
tags: [weather, google, forecast, temperature, real-time, current-conditions, climate, wind, humidity]
metadata: {"clawdbot":{"emoji":"???","requires":{"env":["GOOGLE_API_KEY"]},"primaryEnv":"GOOGLE_API_KEY","secondaryEnv":["GOOGLE_WEATHER_API_KEY","GOOGLE_MAPS_API_KEY"]}}
allowed-tools: [exec]

Google Weather - Real-time Weather Data

Get accurate weather conditions using Google's Weather API. Requires a Google Cloud API key with Weather API enabled.

Quick Usage

# Current weather (formatted output)
python3 skills/google-weather/lib/weather_helper.py current "New York"
python3 skills/google-weather/lib/weather_helper.py current "London"
python3 skills/google-weather/lib/weather_helper.py current "Sydney"

# 24h Forecast
python3 skills/google-weather/lib/weather_helper.py forecast "Tel Aviv"

# Raw JSON data
python3 skills/google-weather/lib/weather_helper.py json "Paris"

Example Output

*New York*
Partly Cloudy ?
??? 12°C (feels like 10°C)
?? Wind: 18 km/h NORTHWEST
?? Humidity: 55%
*24h Forecast for Tel Aviv*
18:00: 17.8°C, ?? 5 km/h NORTH
22:00: 14.3°C, ?? 6 km/h EAST_NORTHEAST
02:00: 12.8°C, ? 8 km/h NORTHEAST
06:00: 10.8°C, ?? 6 km/h EAST_NORTHEAST
10:00: 16.1°C, ?? 5 km/h SOUTH
14:00: 20.4°C, ??? 8 km/h WEST_NORTHWEST

Supported Locations

Any location worldwide - just type the city name:

  • New York, London, Paris, Berlin, Sydney
  • San Francisco, Berlin, Singapore, Dubai
  • Or any address, landmark, or coordinates

The skill automatically geocodes locations using Google Maps API.

Data Available

  • Temperature: Current + feels like
  • Conditions: Clear, cloudy, rain, snow, etc. with emoji icons
  • Forecast: Hourly data for temperature, wind, and conditions
  • Humidity: Percentage
  • Wind: Speed, direction, gusts
  • UV Index: Sun exposure level
  • Precipitation: Probability and type
  • Cloud Cover: Percentage
  • Visibility: Distance

Setup

  1. Create a project in Google Cloud Console
  2. Enable the Weather API
  3. Enable the Geocoding API (for location name lookup)
  4. Create an API key and set it as GOOGLE_API_KEY environment variable

Also supports GOOGLE_WEATHER_API_KEY or GOOGLE_MAPS_API_KEY if you already have one configured.

Multi-language Support

Output adapts to location - supports English, Hebrew, and other languages based on the language parameter.

# Hebrew output
python3 skills/google-weather/lib/weather_helper.py current "Tel Aviv"
# Output: ???? ?? 19°C...

相关推荐