Install
openclaw skills install @stevenho1394/hk-weather-infoHong Kong weather information — current conditions, forecasts from HKO (Hong Kong Observatory). Use when user asks about HK weather, temperature, rainfall, or weather forecast.
openclaw skills install @stevenho1394/hk-weather-infoHong Kong weather skill using HKO (Hong Kong Observatory) OpenData API. Provides current weather reports and local weather forecasts. Supports regional filtering and multilingual output (English, Traditional Chinese, Simplified Chinese).
HKO OpenData API — free, no API key required.
https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang=<lang>https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=flw&lang=<lang>| Variable | Description | Values |
|---|---|---|
HK_WEATHER_INFO_REGION | Target region/district. If None, returns general HK weather. | e.g. "Tsuen Wan", "Central", None |
HK_WEATHER_INFO_LANG | Language preference | tc (Traditional Chinese, default), en (English), sc (Simplified Chinese) |
Ask user for target region/district. If user refuses or says "general/whole HK", set HK_WEATHER_INFO_REGION = None.
Default to tc (Traditional Chinese) unless user specifies otherwise. Supported:
tc — Traditional Chinese (繁體中文) — defaulten — Englishsc — Simplified Chinese (简体中文)Store as HK_WEATHER_INFO_LANG. Default is tc if not set.
Call:
GET https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang=<HK_WEATHER_INFO_LANG>
The API returns JSON with:
temperature — array of {place, value, unit}humidity — {value, unit}rainfall — array of {place, value, unit}icon — weather icon codeuvindex — UV index (if available)updateTime — timestampwarningMessage — active warnings (string)rainstormReminder — rainstorm reminder (string)Regional filtering: If HK_WEATHER_INFO_REGION is set (not None):
temperature array for entry where place matches the region (case-insensitive partial match)rainfall array for entry where place matches the regionIf no match found or HK_WEATHER_INFO_REGION is None:
Call:
GET https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=flw&lang=<HK_WEATHER_INFO_LANG>
The API returns JSON with:
generalSituation — general weather situationforecastDesc — forecast descriptionoutlook — outlookforecastPeriod — string (wind direction letters, NOT an array). Use forecastDesc for the human-readable forecast text.updateTime — timestampRegional filtering: If HK_WEATHER_INFO_REGION is set:
Display today's and tomorrow's forecast by default.
After completing Steps 1 and 2, fetch the latest 1-minute average temperature from HKO CSV.
Reference:
references/1min-temp-csv.md— actual column names, alias mapping, gotchas.
Based on HK_WEATHER_INFO_LANG:
| Language | CSV URL |
|---|---|
en | https://data.weather.gov.hk/weatherAPI/hko_data/regional-weather/latest_1min_temperature.csv |
tc | https://data.weather.gov.hk/weatherAPI/hko_data/regional-weather/latest_1min_temperature_uc.csv |
sc | https://data.weather.gov.hk/weatherAPI/hko_data/regional-weather/latest_1min_temperature_sc.csv |
| any other value | Do not fetch CSV |
curl (or urllib).The CSV column names vary by language. Actual column names observed:
| Language | Place column | Temperature column |
|---|---|---|
tc | 自動氣象站 | 氣溫(攝氏) |
en | Automatic Weather Station | Air Temperature(degree Celsius) |
sc | (similar Chinese names) | (similar Chinese names) |
The CSV starts with a UTF-8 BOM (\ufeff) — strip it before parsing or the first column key will be malformed.
The CSV contains ~39 automatic weather stations with specific station names (e.g. 荃灣可觀, 赤鱲角, 京士柏), not district names. When matching regions:
HK_WEATHER_INFO_REGION is set: try direct partial match first, then try English-to-Chinese alias mapping (e.g. "Tsuen Wan" → 荃灣, "Central" → 中環). Use the first matched station's temperature.HK_WEATHER_INFO_REGION is not set or no match found: compute the average of all stations' temperature values and present it as the 1-minute average temperature of Hong Kong overall.If a 1-minute average temperature was successfully obtained, append it to the reply:
TC output:
🕒 1分鐘平均氣溫:XX°C([地區名稱 / 全港平均])
EN output:
🕒 1-Min Avg Temp: XX°C ([Region Name / HK Average])
SC output:
🕒 1分钟平均气温:XX°C([地区名称 / 全港平均])
When lang=tc (default), the HKO API returns all text fields in Traditional Chinese. Use Chinese labels for consistency:
🇭🇰 香港天氣 [地區]
🌡️ 氣溫:XX°C(測站名稱)
💧 濕度:XX%
🌧️ 雨量:XXmm(測站名稱)
☀️ 紫外線指數:XX(如有)
⚠️ 生效警告:[警告內容 / 無]
🕐 更新時間:<updateTime>
📅 天氣預測
📋 概況:<generalSituation>
📅 今日:<forecast> | 溫度:<tempRange>°C | 濕度:<rhRange>%
📅 明日:<forecast> | 溫度:<tempRange>°C | 濕度:<rhRange>%
🔮 展望:<outlook>
🕐 更新時間:<updateTime>
When lang=en, use English labels:
🌤️ Hong Kong Weather [Region if set]
Temperature: XX°C (Station Name)
Humidity: XX%
...
Forecast: <forecastDesc>
Always check system time first. Run date '+%Y-%m-%d %H:%M:%S %Z' and convert to HKT (UTC+8) before responding. Never assume the date from conversation context or system prompt timestamps. The conversation may span multiple days.
No API key required. HKO OpenData is free and open.
scripts/hk_weather.py — CLI client with 10-min file cache. Default language is tc (Traditional Chinese).
python3 scripts/hk_weather.py # General HK, Traditional Chinese (default)
python3 scripts/hk_weather.py --region "Tsuen Wan" # Regional, TC
python3 scripts/hk_weather.py --lang en # English output
python3 scripts/hk_weather.py --action current # Current only
python3 scripts/hk_weather.py --action forecast # Forecast only
--lang tc. All output (including labels) should be in Traditional Chinese unless user specifies --lang en or --lang sc. The HKO API returns Chinese text fields when lang=tc, so output labels must also be in Chinese for consistency.lang parameter affects all text fieldsvalue key — always check "value" in matched before accessing. Some stations report empty/missing rainfall data differently.forecastPeriod is a string, not an array — the flw API returns forecastPeriod as a string (wind direction letters), NOT an array of forecast period objects. Use forecastDesc for the human-readable forecast text.\ufeff. Strip before parsing or the first column key will be corrupted. The CSV also uses language-specific Chinese column names (e.g. 自動氣象站, 氣溫(攝氏)), not the generic 地區/溫度 names.荃灣可觀, 赤鱲角), not district names. English region names like "Tsuen Wan" won't directly match Chinese station names — use alias mapping (e.g. "Tsuen Wan" → 荃灣).warningMessage formatting: HKO API can return a list of warning strings, not just a single string. Now iterates and prints each warning on its own line.forecastPeriod description in SKILL.md: it's a string (wind direction), not an array. Removed contradictory description.match_region to support English→Chinese alias mapping for current weather regional filtering."percent" instead of `"%".