pawkakol1 / worlds-air-quality-index

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

Error on device update #37

Closed bakboord4 closed 1 year ago

bakboord4 commented 1 year ago

Please find below 3 error loggings of presumably the same issue. Home assistant: 2023.3.0 World air quality index: V1.0.0.

2023-03-01 23:03:09.555 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' 2023-03-01 23:03:09.644 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' 2023-03-01 23:03:09.736 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

Could you @bakboord4 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.

bakboord4 commented 1 year ago

Configured two stations. Please see two attachments for the requested station information.



Op 2 mrt. 2023, om 20:20 heeft pawkakol1 @.***> het volgende geschreven:

Could you @bakboord4 https://github.com/bakboord4 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.

— Reply to this email directly, view it on GitHub https://github.com/pawkakol1/worlds-air-quality-index/issues/37#issuecomment-1452429503, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFSM2GKSDN627NRLTXE4ETW2DXJLANCNFSM6AAAAAAVNK5JVQ. You are receiving this because you were mentioned.

pawkakol1 commented 1 year ago

@bakboord4 unfortunately your attachments are just [obj] [obj] I can't see them

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

bakboord4 commented 1 year ago

station ID’s:

  1. IDx: 7937 Version 0.3.7 by pawkakol1
  2. IDx: A205348 Version 0.3.5 by pawkakol0

Copied your forecast branch and restarted HA Startup gave one error: Station kraanvogellaan doesn't support forecast

Kraanvogellaan is station IDx nr. 2 and now on Version 0.3.7!

Will continue to test and will let you know the outcome.

Op 2 mrt. 2023, om 21:18 heeft pawkakol1 @.***> het volgende geschreven:

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

— Reply to this email directly, view it on GitHub https://github.com/pawkakol1/worlds-air-quality-index/issues/37#issuecomment-1452492664, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFSM2FW2OPWNKZ4C2BQG7DW2D6CJANCNFSM6AAAAAAVNK5JVQ. You are receiving this because you were mentioned.

bakboord4 commented 1 year ago

In my last mail about applying your fix, I reported an error at startup. That is incorrect; it was a warning.

Op 2 mrt. 2023, om 21:18 heeft pawkakol1 @.***> het volgende geschreven:

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

— Reply to this email directly, view it on GitHub https://github.com/pawkakol1/worlds-air-quality-index/issues/37#issuecomment-1452492664, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFSM2FW2OPWNKZ4C2BQG7DW2D6CJANCNFSM6AAAAAAVNK5JVQ. You are receiving this because you were mentioned.

pawkakol1 commented 1 year ago

Yeah, I added verification if API contains forecast. If it contains, then forecast is read, and saved in sensors If API doesn't contain forecast I log warning f"Station {name} doesn't support forecast"

But I will change it from warning to info level today's evening, then I will test it in Docker with your station ID. Then propably I will release fixed version

bakboord4 commented 1 year ago

Perfect!

Op 3 mrt. 2023, om 09:27 heeft pawkakol1 @.***> het volgende geschreven:

Yeah, I added verification if API contains forecast. If it contains, then forecast is read, and saved in sensors If API doesn't contain forecast I log warning f"Station {name} doesn't support forecast"

But I will change it from warning to info level today's evening, then I will test it in Docker with your station ID. Then propably I will release fixed version

— Reply to this email directly, view it on GitHub https://github.com/pawkakol1/worlds-air-quality-index/issues/37#issuecomment-1453154205, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFSM2FQJA43KSSLKQNPN7DW2GTPDANCNFSM6AAAAAAVNK5JVQ. You are receiving this because you were mentioned.

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

bakboord4 commented 1 year ago

thanks for the quick response and your efforts you have put in to solve this issue.

Op 3 mrt. 2023, om 19:59 heeft pawkakol1 @.***> het volgende geschreven:

Closed #37 https://github.com/pawkakol1/worlds-air-quality-index/issues/37 as completed.

— Reply to this email directly, view it on GitHub https://github.com/pawkakol1/worlds-air-quality-index/issues/37#event-8662630154, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFSM2AOOWOEE4OJOVBZFYDW2I5QXANCNFSM6AAAAAAVNK5JVQ. You are receiving this because you were mentioned.