Git Product home page Git Product logo

Comments (8)

VergilGao avatar VergilGao commented on August 28, 2024 1

并不是天气数据超时。

我将代码里所有的 _temperature_unit 的读写硬编码为了 TEMP_CELSIUS
现在程序不会报错并且已经可以生成对应的实体了

我去看了其他天气预报的库,比如 https://github.com/home-assistant/core/blob/f6fd7d115e6813d7980a6521919e0021f6415b94/homeassistant/components/homematicip_cloud/weather.py
他们现在限制了子类对于父类私有变量的 setter

简单看了一下,提了个pr修复了这个bug

from heweather.

c1pher-cn avatar c1pher-cn commented on August 28, 2024

检查和风控制台里你是否已经升级到开发者账号

如果确认是开发者账号,用你的location和key 请求下面的接口,如果不返回天气信息就说明还没有开发者权限,等和风账号更新就行(刚申请的账号可能要等一天)
https://devapi.qweather.com/v7/weather/24h?location=ABCD&key=ABCD

from heweather.

c1pher-cn avatar c1pher-cn commented on August 28, 2024

如果下面这个接口能访问,你贴下你这个接口返回的内容,和你具体配置的location

from heweather.

THLIVSQAZ avatar THLIVSQAZ commented on August 28, 2024

是开发者账号
Screen Shot 2022-09-20 at 23 12 38

下面是请求数据

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.

c1pher-cn avatar c1pher-cn commented on August 28, 2024

看起来数据和权限都没问题,应该是请求天气数据超时了。 你可以运营一段时间再看看(这个数据每30分钟会更新)或者直接重启ha也会再次请求,我代码里没有做太多错误处理

from heweather.

THLIVSQAZ avatar THLIVSQAZ commented on August 28, 2024

好的,谢谢

from heweather.

c1pher-cn avatar c1pher-cn commented on August 28, 2024

@THLIVSQAZ 可以更新文件再试下,已经找到问题并修复了 ,感谢 @VergilGao

from heweather.

THLIVSQAZ avatar THLIVSQAZ commented on August 28, 2024

可以了,感谢两位大佬,谢谢

from heweather.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.