pawkakol1 / worlds-air-quality-index

HACS World's Air Quality Index integration from waqi.info
43 stars 12 forks source link

error #38

Closed chuk-a closed 1 year ago

chuk-a commented 1 year ago

2023-03-03 01:03:17.295 ERROR (MainThread) [homeassistant.components.sensor] worlds_air_quality_index: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 732, in async_device_update await task File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/worlds_air_quality_index/sensor.py", line 214, in update if self._resType in self._data['data']['forecast']['daily']: KeyError: 'forecast'

pawkakol1 commented 1 year ago

Did you update it? What HA version do you have?

pawkakol1 commented 1 year ago

Could you @chuk-a send me your station ID, because I cannot to reproduce it in my HA - I also use Home assistant: 2023.3.0 and World air quality index: V1.0.0.

pawkakol1 commented 1 year ago

I think, I found the solution for you, but I can't to verify it, because my stations work without this fix. The fixed code is available in "bugFix/forecast" branch: https://github.com/pawkakol1/worlds-air-quality-index/tree/bugFix/forecast If you want, you can replace custom_component in your config by custom component from above branch image

chuk-a commented 1 year ago

hey Pawkakol1, I am using HA 2023.3. After updating to V1.0.0, it happened with the following stations: A44098; A368482; A369379

chuk-a commented 1 year ago

I think the problem is related to the Purple air stations.

pawkakol1 commented 1 year ago

I will check it in today's evening

pawkakol1 commented 1 year ago

I tested the bug fix with your stations, and it works proper now https://github.com/pawkakol1/worlds-air-quality-index/releases/tag/v1.0.1