Comments (8)
并不是天气数据超时。
我将代码里所有的 _temperature_unit 的读写硬编码为了 TEMP_CELSIUS
现在程序不会报错并且已经可以生成对应的实体了
我去看了其他天气预报的库,比如 https://github.com/home-assistant/core/blob/f6fd7d115e6813d7980a6521919e0021f6415b94/homeassistant/components/homematicip_cloud/weather.py
他们现在限制了子类对于父类私有变量的 setter
简单看了一下,提了个pr修复了这个bug
from heweather.
检查和风控制台里你是否已经升级到开发者账号
如果确认是开发者账号,用你的location和key 请求下面的接口,如果不返回天气信息就说明还没有开发者权限,等和风账号更新就行(刚申请的账号可能要等一天)
https://devapi.qweather.com/v7/weather/24h?location=ABCD&key=ABCD
from heweather.
如果下面这个接口能访问,你贴下你这个接口返回的内容,和你具体配置的location
from heweather.
下面是请求数据
https://devapi.qweather.com/v7/weather/24h?location=101280101&key=
{
"code": "200",
"updateTime": "2022-09-20T22:35+08:00",
"fxLink": "http://hfx.link/3ha1",
"hourly": [
{
"fxTime": "2022-09-21T00:00+08:00",
"temp": "26",
"icon": "151",
"text": "多云",
"wind360": "73",
"windDir": "东北风",
"windScale": "3-4",
"windSpeed": "13",
"humidity": "83",
"pop": "25",
"precip": "0.0",
"pressure": "1010",
"cloud": "100",
"dew": "23"
},
{
"fxTime": "2022-09-21T01:00+08:00",
"temp": "25",
"icon": "302",
"text": "雷阵雨",
"wind360": "66",
"windDir": "东北风",
"windScale": "3-4",
"windSpeed": "13",
"humidity": "80",
"pop": "58",
"precip": "1.3",
"pressure": "1011",
"cloud": "100",
"dew": "22"
},
{
"fxTime": "2022-09-21T02:00+08:00",
"temp": "25",
"icon": "302",
"text": "雷阵雨",
"wind360": "60",
"windDir": "东北风",
"windScale": "1-2",
"windSpeed": "11",
"humidity": "83",
"pop": "58",
"precip": "1.3",
"pressure": "1011",
"cloud": "100",
"dew": "22"
},
{
"fxTime": "2022-09-21T03:00+08:00",
"temp": "25",
"icon": "151",
"text": "多云",
"wind360": "59",
"windDir": "东北风",
"windScale": "1-2",
"windSpeed": "11",
"humidity": "89",
"pop": "49",
"precip": "0.0",
"pressure": "1010",
"cloud": "83",
"dew": "23"
},
{
"fxTime": "2022-09-21T04:00+08:00",
"temp": "25",
"icon": "151",
"text": "多云",
"wind360": "61",
"windDir": "东北风",
"windScale": "3-4",
"windSpeed": "13",
"humidity": "93",
"pop": "19",
"precip": "0.0",
"pressure": "1010",
"cloud": "67",
"dew": "24"
},
{
"fxTime": "2022-09-21T05:00+08:00",
"temp": "24",
"icon": "151",
"text": "多云",
"wind360": "61",
"windDir": "东北风",
"windScale": "3-4",
"windSpeed": "13",
"humidity": "100",
"pop": "19",
"precip": "0.0",
"pressure": "1009",
"cloud": "50",
"dew": "24"
},
{
"fxTime": "2022-09-21T06:00+08:00",
"temp": "25",
"icon": "151",
"text": "多云",
"wind360": "60",
"windDir": "东北风",
"windScale": "3-4",
"windSpeed": "13",
"humidity": "97",
"pop": "24",
"precip": "0.0",
"pressure": "1008",
"cloud": "67",
"dew": "24"
},
{
"fxTime": "2022-09-21T07:00+08:00",
"temp": "25",
"icon": "101",
"text": "多云",
"wind360": "112",
"windDir": "东南风",
"windScale": "1-2",
"windSpeed": "11",
"humidity": "97",
"pop": "44",
"precip": "0.0",
"pressure": "1007",
"cloud": "83",
"dew": "25"
},
{
"fxTime": "2022-09-21T08:00+08:00",
"temp": "26",
"icon": "101",
"text": "多云",
"wind360": "107",
"windDir": "东南风",
"windScale": "1-2",
"windSpeed": "11",
"humidity": "91",
"pop": "48",
"precip": "0.0",
"pressure": "1007",
"cloud": "100",
"dew": "24"
},
{
"fxTime": "2022-09-21T09:00+08:00",
"temp": "27",
"icon": "302",
"text": "雷阵雨",
"wind360": "100",
"windDir": "东风",
"windScale": "1-2",
"windSpeed": "11",
"humidity": "80",
"pop": "52",
"precip": "1.3",
"pressure": "1007",
"cloud": "98",
"dew": "23"
},
{
"fxTime": "2022-09-21T10:00+08:00",
"temp": "28",
"icon": "101",
"text": "多云",
"wind360": "88",
"windDir": "东风",
"windScale": "1-2",
"windSpeed": "11",
"humidity": "68",
"pop": "44",
"precip": "0.0",
"pressure": "1007",
"cloud": "96",
"dew": "21"
},
{
"fxTime": "2022-09-21T11:00+08:00",
"temp": "27",
"icon": "302",
"text": "雷阵雨",
"wind360": "67",
"windDir": "东北风",
"windScale": "1-2",
"windSpeed": "11",
"humidity": "71",
"pop": "52",
"precip": "1.3",
"pressure": "1008",
"cloud": "94",
"dew": "21"
},
{
"fxTime": "2022-09-21T12:00+08:00",
"temp": "29",
"icon": "101",
"text": "多云",
"wind360": "42",
"windDir": "东北风",
"windScale": "3-4",
"windSpeed": "13",
"humidity": "57",
"pop": "48",
"precip": "0.0",
"pressure": "1009",
"cloud": "96",
"dew": "20"
},
{
"fxTime": "2022-09-21T13:00+08:00",
"temp": "30",
"icon": "101",
"text": "多云",
"wind360": "25",
"windDir": "东北风",
"windScale": "3-4",
"windSpeed": "13",
"humidity": "52",
"pop": "20",
"precip": "0.0",
"pressure": "1010",
"cloud": "98",
"dew": "20"
},
{
"fxTime": "2022-09-21T14:00+08:00",
"temp": "31",
"icon": "101",
"text": "多云",
"wind360": "17",
"windDir": "东北风",
"windScale": "3-4",
"windSpeed": "13",
"humidity": "49",
"pop": "20",
"precip": "0.0",
"pressure": "1010",
"cloud": "99",
"dew": "19"
},
{
"fxTime": "2022-09-21T15:00+08:00",
"temp": "33",
"icon": "101",
"text": "多云",
"wind360": "22",
"windDir": "东北风",
"windScale": "3-4",
"windSpeed": "13",
"humidity": "45",
"pop": "20",
"precip": "0.0",
"pressure": "1011",
"cloud": "85",
"dew": "19"
},
{
"fxTime": "2022-09-21T16:00+08:00",
"temp": "32",
"icon": "101",
"text": "多云",
"wind360": "39",
"windDir": "东北风",
"windScale": "3-4",
"windSpeed": "13",
"humidity": "46",
"pop": "20",
"precip": "0.0",
"pressure": "1011",
"cloud": "70",
"dew": "19"
},
{
"fxTime": "2022-09-21T17:00+08:00",
"temp": "31",
"icon": "101",
"text": "多云",
"wind360": "62",
"windDir": "东北风",
"windScale": "3-4",
"windSpeed": "13",
"humidity": "48",
"pop": "20",
"precip": "0.0",
"pressure": "1010",
"cloud": "55",
"dew": "19"
},
{
"fxTime": "2022-09-21T18:00+08:00",
"temp": "30",
"icon": "101",
"text": "多云",
"wind360": "116",
"windDir": "东南风",
"windScale": "3-4",
"windSpeed": "13",
"humidity": "54",
"pop": "19",
"precip": "0.0",
"pressure": "1010",
"cloud": "58",
"dew": "20"
},
{
"fxTime": "2022-09-21T19:00+08:00",
"temp": "29",
"icon": "151",
"text": "多云",
"wind360": "160",
"windDir": "东南风",
"windScale": "3-4",
"windSpeed": "13",
"humidity": "61",
"pop": "16",
"precip": "0.0",
"pressure": "1010",
"cloud": "61",
"dew": "21"
},
{
"fxTime": "2022-09-21T20:00+08:00",
"temp": "28",
"icon": "151",
"text": "多云",
"wind360": "167",
"windDir": "东南风",
"windScale": "3-4",
"windSpeed": "13",
"humidity": "68",
"pop": "16",
"precip": "0.0",
"pressure": "1010",
"cloud": "64",
"dew": "22"
},
{
"fxTime": "2022-09-21T21:00+08:00",
"temp": "27",
"icon": "151",
"text": "多云",
"wind360": "165",
"windDir": "东南风",
"windScale": "1-2",
"windSpeed": "11",
"humidity": "72",
"pop": "20",
"precip": "0.0",
"pressure": "1010",
"cloud": "70",
"dew": "22"
},
{
"fxTime": "2022-09-21T22:00+08:00",
"temp": "26",
"icon": "302",
"text": "雷阵雨",
"wind360": "161",
"windDir": "东南风",
"windScale": "1-2",
"windSpeed": "11",
"humidity": "78",
"pop": "60",
"precip": "1.3",
"pressure": "1010",
"cloud": "76",
"dew": "22"
},
{
"fxTime": "2022-09-21T23:00+08:00",
"temp": "26",
"icon": "302",
"text": "雷阵雨",
"wind360": "158",
"windDir": "东南风",
"windScale": "1-2",
"windSpeed": "11",
"humidity": "81",
"pop": "60",
"precip": "1.3",
"pressure": "1010",
"cloud": "81",
"dew": "22"
}
],
"refer": {
"sources": [
"QWeather",
"NMC",
"ECMWF"
],
"license": [
"no commercial use"
]
}
}
from heweather.
看起来数据和权限都没问题,应该是请求天气数据超时了。 你可以运营一段时间再看看(这个数据每30分钟会更新)或者直接重启ha也会再次请求,我代码里没有做太多错误处理
from heweather.
好的,谢谢
from heweather.
@THLIVSQAZ 可以更新文件再试下,已经找到问题并修复了 ,感谢 @VergilGao
from heweather.
可以了,感谢两位大佬,谢谢
from heweather.
Related Issues (20)
- 大佬,升级2023.6.0以后,实体全部不可用,如图 HOT 13
- 升级失效了,请大佬适配下 ha 2023.6.0之后运行出错 HOT 2
- WeatherEntity不能用了 HOT 2
- 大佬,能看下这个日志里的错误提示是什么意思吗? HOT 12
- 大佬请问这个错误怎么解决?custom_components.heweather_forecast.weather::LocalWeather is overriding deprecated methods on an instance of WeatherEntity, this is not valid and will be unsupported from Home Assistant 2023.1. Please report it to the custom integration author. HOT 2
- 大佬,有考虑集成到HACS吗,否则很多人使用起来成本较大 HOT 9
- what can i do ? HOT 3
- 配置sensor时出错 HOT 2
- 有api马上要取消了 HOT 7
- 可不可以给名字加个前缀
- 升级 homeassistant core 2024.1.6后 heweather 实体不可用 HOT 1
- 小时天气预警显示unkown HOT 2
- LENGTH_KILOMETERS was used from heweather, this is a deprecated constant which will be removed in HA Core 2025.1. HOT 1
- 配置 HOT 1
- 不支持 "textDay": "小到中雨" HOT 1
- Home Assistant 2023.6.0插件报错 HOT 2
- 大佬,升级2023.5.2以后,发现heweather 这个插件无法使用,日志里报错 HOT 20
- - guomin #过敏指数 - liangshai #晾晒指数 - fangshai #防晒指数 - kongtiao #空调指数 能否换成英文 HOT 2
- 安装问题 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from heweather.