接入简明天气
简述
Lua表盘可通过读取快应用内部存储目录的方式,接入简明天气的数据,显示在表盘上
Lua表盘接入示例(适用于v2.4.0+数据结构)
https://github.com/zaona/simple-weather-watchface
v2.4.0+
数据位置
/data/quickapp/files/com.application.zaona.weather/weather.txt
数据结构
具体如下方数据结构示例,其中daily字段与和风天气每日天气数据daily字段数据相同,hourly字段仅保留和风天气逐小时天气数据中的fxtime``temp``icon``text字段,alerts字段仅保留title(由eventType.name+color.code中文+“预警”拼接)、expireTime、description
daily列表的数据长度可能为3-30天,hourly列表的数据长度可能为72-168小时
注意
hourly和alerts字段可能为空,请在代码内注意相关处理
附和风天气文档:每日天气预报 for API 逐小时天气预报 for API
`{
"code": "200",
"locationId": "101190201",
"updateTime": "2026-04-03T16:08:03+08:00",
"daily": [
{
"fxDate": "2026-04-03",
"sunrise": "05:39",
"sunset": "18:17",
"moonrise": "07:24",
"moonset": "22:17",
"moonPhase": "盈凸月",
"moonPhaseIcon": "803",
"tempMax": "22",
"tempMin": "14",
"iconDay": "101",
"textDay": "多云",
"iconNight": "150",
"textNight": "晴",
"wind360Day": "90",
"windDirDay": "东风",
"windScaleDay": "1-3",
"windSpeedDay": "15",
"wind360Night": "45",
"windDirNight": "东北风",
"windScaleNight": "1-3",
"windSpeedNight": "12",
"humidity": "65",
"precip": "0.0",
"pressure": "1015",
"vis": "25",
"cloud": "34",
"uvIndex": "5"
}
],
"hourly": [
{
"fxTime": "2026-04-03T11:00+08:00",
"temp": "20",
"icon": "101",
"text": "多云"
}
],
"alerts": [
{
"title": "大风蓝色预警",
"expireTime": "2026-04-04T15:00+08:00",
"description": "预计未来24小时将出现6级以上大风..."
}
],
"location": "无锡"
}`