Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on device update #37

Closed
bakboord4 opened this issue Mar 2, 2023 · 10 comments
Closed

Error on device update #37

bakboord4 opened this issue Mar 2, 2023 · 10 comments
Assignees

Comments

@bakboord4
Copy link

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
Copy link
Owner

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.

@pawkakol1 pawkakol1 self-assigned this Mar 2, 2023
@bakboord4
Copy link
Author

bakboord4 commented Mar 2, 2023 via email

@pawkakol1
Copy link
Owner

pawkakol1 commented Mar 2, 2023

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

@pawkakol1
Copy link
Owner

pawkakol1 commented Mar 2, 2023

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
Copy link
Author

bakboord4 commented Mar 2, 2023 via email

@bakboord4
Copy link
Author

bakboord4 commented Mar 3, 2023 via email

@pawkakol1
Copy link
Owner

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
Copy link
Author

bakboord4 commented Mar 3, 2023 via email

@pawkakol1
Copy link
Owner

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
Copy link
Author

bakboord4 commented Mar 3, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants