briis / smartweather

WeatherFlow Smart Weather Component for Home Assistant
MIT License
108 stars 11 forks source link

error last version homeassistant #78

Closed jinda789 closed 3 years ago

jinda789 commented 3 years ago

This error originated from a custom integration.

Logger: custom_components.smartweather Source: helpers/update_coordinator.py:147 Integration: WeatherFlow Smart Weather (documentation, issues) First occurred: 14:28:48 (2 occurrences) Last logged: 14:29:52

Unexpected error fetching smartweather data: 'NoneType' object is not subscriptable Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data return await self.update_method() File "/usr/local/lib/python3.9/site-packages/pysmartweatherio/client.py", line 117, in get_device_data return await self._device_info() File "/usr/local/lib/python3.9/site-packages/pysmartweatherio/client.py", line 457, in _device_info obs = json_data["obs"][0] TypeError: 'NoneType' object is not subscriptable

briis commented 3 years ago

Basically this errors says we did not get the right data. Do you have your own WeatherFlow station with your personal Token? Or are using the developer key?

jinda789 commented 3 years ago

yes, i have weatherflow station and use personal token

jinda789 commented 3 years ago

i type test manual

path in function https://github.com/briis/pysmartweatherio/blob/master/pysmartweatherio/client.py async def _device_info(self) -> None: https://swd.weatherflow.com/swd/rest/observations/device/mydeviceid?token=mytoken have error 404

but can use https://swd.weatherflow.com/swd/rest/observations/?device_id=mydeviceid&token=mytoken have normal data

https://weatherflow.github.io/Tempest/api/

briis commented 3 years ago

Strange, I can get both of the above REST calls to work, and they return the same data. But, I have made a new version of the pysmartweatherio module, that you can test. If you go to your HA installation and then go to the custom_components/smartweather directory. Find the file manifest.json and change this section

    "requirements": [
        "pysmartweatherio==2.1.10"
    ],

to

    "requirements": [
        "pysmartweatherio==2.1.11"
    ],

Then restart Home Assistant, and try again. This will now use the REST command you suggest above.

jinda789 commented 3 years ago

oh same error image It's okay, I'll try again.

briis commented 3 years ago

What is your Station ID? Then I can try it from here, and see if I get the error.

jinda789 commented 3 years ago

my station id : 19912

briis commented 3 years ago

Just tested this, and I can reproduce the error. But I think you have an issue with this station, as it does not report any data to WeatherFlow, and that is why the Integration is failing. The line obs = json_data["obs][0] would normally contain some observation data, but it reports None instead, and that is why the setup fails.

Could you check that your station is online, and is reporting data to WeatherFlow. The lamp on the back of the Hub needs to be green. If it is red, pull the power and reinsert it. If that still does not work, there must be something with the WiFi setup.

jinda789 commented 3 years ago

test my station is light green and online now image

public data https://tempestwx.com/station/19912/grid

jinda789 commented 3 years ago

data in postman

image image image

jinda789 commented 3 years ago

Oh! my data is comeback to normal. I fixed it by remove old device (offline). Previously there were 2 device online 1 offline 1

thx you sir

briis commented 3 years ago

Glad it works now. Please close the issue if everything works.