Weather

Weather

4.2 (67)

Get current weather conditions and forecasts without requiring an API key. Uses multiple data sources to provide accurate weather information for any location worldwide.

Weather Skill

Weather skill provides real-time weather information and forecasts without requiring external API keys. Perfect for agents that need to provide weather context in conversations or workflows.

Overview

This skill leverages free, public weather data sources to deliver accurate weather information worldwide. No registration or API keys needed - just plug and play.

Installation

# Included with OpenClaw installation
npm install @openclaw/skill-weather

Usage

Current Weather

import { weather } from '@openclaw/skills';

const current = await weather.getCurrent({
  latitude: 40.7128,
  longitude: -74.0060,
  city: 'New York'
});

Forecast

const forecast = await weather.getForecast({
  latitude: 51.5074,
  longitude: -0.1278,
  city: 'London',
  days: 7
});

Weather by City

const weather = await weather.getByCity({
  city: 'Beijing',
  units: 'celsius'
});

Response Format

Current Weather

{
  "location": "New York, NY",
  "temperature": 22,
  "feelsLike": 24,
  "humidity": 65,
  "windSpeed": 12,
  "windDirection": "NW",
  "condition": "Partly Cloudy",
  "icon": "02d",
  "visibility": 10,
  "uvIndex": 5,
  "pressure": 1013,
  "lastUpdated": "2025-02-10T14:30:00Z"
}

Forecast Day

{
  "date": "2025-02-11",
  "tempHigh": 25,
  "tempLow": 18,
  "condition": "Sunny",
  "precipitation": 0,
  "humidity": 55,
  "windSpeed": 8
}

Configuration

Default Units

export default {
  skills: {
    weather: {
      defaultUnits: 'metric', // 'metric' or 'imperial'
      forecastDays: 5,
      refreshInterval: 3600 // seconds
    }
  }
};

Data Source Priority

Configure preferred data sources:

{
  dataSources: {
    primary: 'open-meteo',
    fallback: 'weatherapi'
  }
}

Use Cases

  1. Travel Planning - Provide weather context for destinations
  2. Event Planning - Outdoor event weather assessment
  3. Daily Briefings - Include weather in daily agent summaries
  4. Agriculture - Weather data for farming applications
  5. Travel Blogs - Automated weather reports for locations

Integration with OpenClaw

Simple Integration

const agent = new OpenClawAgent({
  skills: [weather]
});

// In conversation
agent.on('message', async (context) => {
  if (context.message.includes('weather')) {
    const location = extractLocation(context.message);
    const current = await weather.getCurrent({ city: location });
    return formatWeatherResponse(current);
  }
});

Proactive Weather Updates

const weatherAgent = new OpenClawAgent({
  skills: [weather],
  triggers: [
    {
      schedule: '0 7 * * *', // 7 AM daily
      handler: async () => {
        const home = await weather.getCurrent({ city: 'Beijing' });
        await appleNotes.create({
          title: 'Morning Weather',
          content: formatWeatherReport(home)
        });
      }
    }
  ]
});

Data Sources

Open-Meteo

WeatherAPI

Limitations

  • Some data sources may have rate limits
  • Historical data not available
  • Severe weather alerts vary by region
  • Air quality data may be limited

Best Practices

  1. Cache weather data to reduce API calls
  2. Use metric units for consistency
  3. Provide multiple data sources for reliability
  4. Handle location ambiguities gracefully

Error Handling

try {
  const weather = await weather.getCurrent({ city: location });
} catch (error) {
  if (error.code === 'LOCATION_NOT_FOUND') {
    // Try alternative location format
  } else if (error.code === 'API_ERROR') {
    // Use fallback data source
  }
}

Resources

Summary

Weather skill provides a reliable, API-key-free solution for integrating weather data into your AI agent. Whether for personal assistants, travel planners, or event managers, this skill delivers accurate and timely weather information worldwide.