Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
Markdown
Weather.mjs AC Piece - Architectural Plan #
Created: December 6, 2025
Status: β
Implemented
π Implementation Complete #
The weather.mjs piece has been implemented as a non-interactive, Weather Channel style passive display featuring:
- Auto-cycling views (10 second intervals): Current Conditions β 7-Day Forecast β Today's Details β Extended Outlook
- Scrolling crawl bar at bottom with current conditions summary
- Open-Meteo API (free, no API key required)
- Geocoding for city name lookup
- Classic Weather Channel "Local on the 8s" aesthetic with blue gradient background, panel layouts, and view indicator dots
Usage #
weather # Weather for New York (default)
weather los angeles # Weather for LA
weather tokyo # Weather for Tokyo
weather 48.8567,2.3508 # Weather by coordinates
π Original Overview #
This document outlines the architecture and implementation plan for a weather.mjs piece that allows users to query and display weather information through the AC prompt system.
π― User Experience Goals #
From AC Prompt Usage: #
weather β Get weather for current location (IP-based)
weather los angeles β Get weather for Los Angeles
weather 90210 β Get weather by ZIP code
weather tokyo β Get weather for Tokyo, Japan
weather 48.8567,2.3508 β Get weather by coordinates (Paris)
weather forecast london β Get multi-day forecast for London
weather --help β Show usage information
Display Options: #
- Current conditions - Temperature, humidity, wind, conditions
- Forecast mode - Multi-day forecast view
- Visual representation - Weather icons, colors based on conditions
- Sound cues - Audio feedback for weather conditions (rain, thunder, etc.)
π¬ Weather API Research & Recommendations #
Option 1: Open-Meteo β RECOMMENDED #
URL: https://open-meteo.com/en/docs
| Pros | Cons |
|---|---|
| β No API key required | β No city name lookup (needs geocoding first) |
| β Completely free for non-commercial use | β Requires separate geocoding API call |
| β No rate limits for reasonable use | |
| β Open source | |
| β High accuracy with multiple weather models | |
| β 16-day forecasts available | |
| β Hourly, daily, and 15-minute data | |
| β No account creation needed |
Example API Call:
https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41¤t=temperature_2m,relative_humidity_2m,weather_code,wind_speed_10m&daily=weather_code,temperature_2m_max,temperature_2m_min&timezone=auto
Geocoding API (also free, no key):
https://geocoding-api.open-meteo.com/v1/search?name=London&count=1
Option 2: WeatherAPI.com #
URL: https://www.weatherapi.com/
| Pros | Cons |
|---|---|
| β Built-in city/ZIP/IP lookup | β Requires API key |
| β Rich data (astronomy, marine, sports) | β Rate limits on free tier |
| β 14-day forecast | β Account creation required |
| β Air quality & pollen data | β Free tier: 1M calls/month |
| β Weather alerts |
Example API Call:
http://api.weatherapi.com/v1/current.json?key=YOUR_KEY&q=London
Option 3: OpenWeatherMap #
URL: https://openweathermap.org/api
| Pros | Cons |
|---|---|
| β Well-documented | β Requires API key |
| β One Call API 3.0 comprehensive | β Free tier: 1000 calls/day |
| β Weather maps available | β Account creation required |
| β Premium features cost money |
π Final Recommendation: Open-Meteo #
Why Open-Meteo is best for AC:
- No API key management - Simplifies deployment, no env vars needed
- No account creation - Zero friction for contributors
- Free forever - No risk of hitting rate limits or unexpected costs
- Open source philosophy - Aligns with AC's spirit
- Excellent data quality - Uses multiple national weather services
Implementation Strategy:
- Use Open-Meteo Geocoding API to convert city names β coordinates
- Use Open-Meteo Weather API with coordinates for weather data
- Support direct lat/lon input for power users
ποΈ AC Piece Architecture #
File Location #
system/public/aesthetic.computer/disks/weather.mjs
Core Structure #
// Weather, 2025.12.06
// Get weather information from the AC prompt.
/* #region π README
Usage:
weather - Weather for current location (IP geolocation)
weather [location] - Weather for a city, ZIP code, or coordinates
weather forecast [location] - Multi-day forecast
Examples:
weather
weather new york
weather 90210
weather 48.8567,2.3508
weather forecast london
#endregion */
/* #region π TODO
- [] Basic weather display
- [] Location geocoding
- [] IP-based geolocation fallback
- [] Multi-day forecast view
- [] Weather condition icons
- [] Sound effects for conditions
- [] Temperature unit toggle (C/F)
#endregion */
let weatherData = null;
let location = null;
let loading = true;
let error = null;
let mode = 'current'; // 'current' or 'forecast'
// π₯Ύ Boot
async function boot({ params, net, num }) {
// Parse command parameters
// Fetch weather data
// Handle geocoding if needed
}
// π¨ Paint
function paint({ wipe, ink, screen, write }) {
// Display weather information
// Show loading state
// Render weather icons
}
// πͺ Act
function act({ event: e }) {
// Handle keyboard input (refresh, toggle units)
}
// π° Meta
function meta({ piece }) {
return {
title: "Weather",
desc: "Check the weather from the prompt.",
};
}
export { boot, paint, act, meta };
API Wrapper Functions #
// Geocoding: City name β Coordinates
async function geocode(query) {
const url = `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(query)}&count=1`;
const res = await fetch(url);
const data = await res.json();
if (data.results && data.results.length > 0) {
return {
name: data.results[0].name,
country: data.results[0].country,
latitude: data.results[0].latitude,
longitude: data.results[0].longitude,
};
}
return null;
}
// Weather: Coordinates β Weather Data
async function getWeather(lat, lon, forecast = false) {
const params = new URLSearchParams({
latitude: lat,
longitude: lon,
current: 'temperature_2m,relative_humidity_2m,apparent_temperature,weather_code,wind_speed_10m,wind_direction_10m,precipitation',
daily: 'weather_code,temperature_2m_max,temperature_2m_min,precipitation_probability_max,sunrise,sunset',
timezone: 'auto',
forecast_days: forecast ? 7 : 1,
});
const url = `https://api.open-meteo.com/v1/forecast?${params}`;
const res = await fetch(url);
return await res.json();
}
// IP Geolocation fallback (using ipinfo.io free tier or similar)
async function getLocationFromIP() {
// Could use various free IP geolocation services
// Or default to a fallback location
}
WMO Weather Codes β Display Mapping #
const WEATHER_CODES = {
0: { text: 'Clear sky', icon: 'βοΈ', color: 'yellow' },
1: { text: 'Mainly clear', icon: 'π€οΈ', color: 'yellow' },
2: { text: 'Partly cloudy', icon: 'β
', color: 'gray' },
3: { text: 'Overcast', icon: 'βοΈ', color: 'gray' },
45: { text: 'Foggy', icon: 'π«οΈ', color: 'gray' },
48: { text: 'Depositing rime fog', icon: 'π«οΈ', color: 'gray' },
51: { text: 'Light drizzle', icon: 'π§οΈ', color: 'blue' },
53: { text: 'Moderate drizzle', icon: 'π§οΈ', color: 'blue' },
55: { text: 'Dense drizzle', icon: 'π§οΈ', color: 'blue' },
56: { text: 'Light freezing drizzle', icon: 'π§οΈ', color: 'teal' },
57: { text: 'Dense freezing drizzle', icon: 'π§οΈ', color: 'teal' },
61: { text: 'Slight rain', icon: 'π§οΈ', color: 'blue' },
63: { text: 'Moderate rain', icon: 'π§οΈ', color: 'blue' },
65: { text: 'Heavy rain', icon: 'π§οΈ', color: 'darkblue' },
66: { text: 'Light freezing rain', icon: 'π¨οΈ', color: 'teal' },
67: { text: 'Heavy freezing rain', icon: 'π¨οΈ', color: 'teal' },
71: { text: 'Slight snow', icon: 'βοΈ', color: 'white' },
73: { text: 'Moderate snow', icon: 'βοΈ', color: 'white' },
75: { text: 'Heavy snow', icon: 'βοΈ', color: 'white' },
77: { text: 'Snow grains', icon: 'βοΈ', color: 'white' },
80: { text: 'Slight rain showers', icon: 'π¦οΈ', color: 'blue' },
81: { text: 'Moderate rain showers', icon: 'π¦οΈ', color: 'blue' },
82: { text: 'Violent rain showers', icon: 'βοΈ', color: 'darkblue' },
85: { text: 'Slight snow showers', icon: 'π¨οΈ', color: 'white' },
86: { text: 'Heavy snow showers', icon: 'π¨οΈ', color: 'white' },
95: { text: 'Thunderstorm', icon: 'βοΈ', color: 'purple' },
96: { text: 'Thunderstorm with slight hail', icon: 'βοΈ', color: 'purple' },
99: { text: 'Thunderstorm with heavy hail', icon: 'βοΈ', color: 'purple' },
};
π Data Flow #
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AC Prompt Input β
β weather [location] [options] β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Parameter Parsing β
β - Extract location string β
β - Detect coordinates vs city name vs ZIP β
β - Parse options (forecast, units, etc.) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββΌββββββββββββββββ
βΌ βΌ βΌ
ββββββββββββββ ββββββββββββββ ββββββββββββββ
β Coordinatesβ β City Name β β No Locationβ
β Detected β β Detected β β (use IP) β
ββββββββββββββ ββββββββββββββ ββββββββββββββ
β β β
β βΌ β
β βββββββββββββββββββ β
β β Open-Meteo β β
β β Geocoding API β β
β βββββββββββββββββββ β
β β β
βββββββββββββββββΌββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββ
β Open-Meteo Weather API β
β (with lat/lon coords) β
βββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββ
β Process & Display β
β - Format temperatures β
β - Map weather codes β
β - Render to screen β
βββββββββββββββββββββββββββββββ
π¨ Visual Design #
Current Weather View #
βββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β βοΈ Clear sky β
β β
β Los Angeles, CA β
β β
β 72Β°F β
β Feels like 74Β°F β
β β
β π¨ Wind: 8 mph NW π§ Humidity: 45% β
β β
β Press R to refresh β
β Press F to toggle Β°F/Β°C β
βββββββββββββββββββββββββββββββββββββββββββββββββ
Forecast View #
βββββββββββββββββββββββββββββββββββββββββββββββββ
β 7-Day Forecast - Los Angeles β
β β
β Today βοΈ 72Β°F / 55Β°F β
β Sat π€οΈ 74Β°F / 58Β°F β
β Sun β
70Β°F / 56Β°F β
β Mon π§οΈ 65Β°F / 52Β°F 40% rain β
β Tue π§οΈ 63Β°F / 50Β°F 60% rain β
β Wed π€οΈ 68Β°F / 54Β°F β
β Thu βοΈ 72Β°F / 56Β°F β
β β
β Press R to refresh β
β Press C for current β
βββββββββββββββββββββββββββββββββββββββββββββββββ
π Audio Integration (Future) #
Weather-appropriate ambient sounds:
- Rain: Gentle rain audio loop
- Thunder: Thunder sound effects
- Wind: Wind ambience for high wind speeds
- Clear: Optional pleasant ambience
Could integrate with AC's sound system via sound.synth() or audio samples.
π οΈ Implementation Phases #
Phase 1: MVP (This PR) #
Phase 2: Enhanced Features #
Phase 3: Polish #
π Files to Create #
system/public/aesthetic.computer/disks/weather.mjs (main piece)
Optionally:
system/public/aesthetic.computer/disks/common/weather-icons.mjs (icon sprites)
system/public/aesthetic.computer/disks/common/weather-api.mjs (API helpers)
π References #
- Open-Meteo API Docs
- Open-Meteo Geocoding API
- WMO Weather Codes
- AC Piece Architecture
- AC Profile Piece (fetch example)
- AC Rain Piece (visual example)
β Success Criteria #
- User can type
weather londonand see current weather - User can type
weatherand get weather based on IP location - User can type
weather forecast parisand see 7-day forecast - Temperature can be toggled between Β°C and Β°F
- Weather conditions are clearly displayed with icons/colors
- Errors are handled gracefully (no location found, API down, etc.)