- 积分
- 753
- 金钱
- 744
- 威望
- 0
- 贡献
- 0
- HASS币
- 0
高级会员
- 积分
- 753
- 金钱
- 744
- HASS币
- 0
|
发表于 2021-3-15 22:28:25
|
显示全部楼层
請教下 HA 2021.3 新增了天氣模板可以自定義天氣預報提供者
但香港天文台 api 預報的 json 跟 HA 所需的格式有點出入
有辦法通過修改後使用嗎?
天文台的 JSON 格式
[
{
"forecastDate": "20210316",
"week": "星期二",
"forecastWind": "東風3至4級。",
"forecastWeather": "大致天晴。",
"forecastMaxtemp": {
"value": 27,
"unit": "C"
},
"forecastMintemp": {
"value": 20,
"unit": "C"
},
"forecastMaxrh": {
"value": 90,
"unit": "percent"
},
"forecastMinrh": {
"value": 65,
"unit": "percent"
},
"ForecastIcon": 51
},
{
"forecastDate": "20210317",
"week": "星期三",
"forecastWind": "東風3級。",
"forecastWeather": "部分時間有陽光。早晚沿岸有薄霧。",
"forecastMaxtemp": {
"value": 26,
"unit": "C"
},
"forecastMintemp": {
"value": 21,
"unit": "C"
},
"forecastMaxrh": {
"value": 95,
"unit": "percent"
},
"forecastMinrh": {
"value": 75,
"unit": "percent"
},
"ForecastIcon": 51
}
]
HA 天氣預報的格式
[
{
"datetime": "2021-03-15T04:00:00+00:00",
"precipitation": null,
"pressure": 1016,
"wind_speed": 3.82,
"wind_bearing": 105,
"condition": "cloudy",
"temperature": 23.6,
"templow": 20.3
},
{
"datetime": "2021-03-16T04:00:00+00:00",
"precipitation": null,
"pressure": 1015,
"wind_speed": 2.56,
"wind_bearing": 97,
"condition": "cloudy",
"temperature": 25.6,
"templow": 20.9
}
]
|
|