pawkakol1 / worlds-air-quality-index

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

Air Quality Index Not Updating #27

Closed NickM-27 closed 2 years ago

NickM-27 commented 2 years ago

After 0.3.4 air_quality_index is unavailable and I see this error in the logs:

worlds_air_quality_index: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 703, 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 194, in update
    if _data["data"]["aqi"] == "-":
NameError: name '_data' is not defined
wayned1014 commented 2 years ago

I was able to fix the error on my system by editing:

/config/custom_components/worlds_air_quality_index/sensor.py

and on lines 194 and 198 changing "_data" to "self._data" (without the quotes) on both lines and restarting HA. That will fix it until it is changed in the repository.

pawkakol1 commented 2 years ago

@NickM-27 and @wayned1014 I fixed it, and I released it, as https://github.com/pawkakol1/worlds-air-quality-index/releases/tag/v0.3.5-beta1 prerelease version, because I'm not able to check it now. You can enable to show prerelease versions, and try to update integration to this prerelease version.

attila123456 commented 2 years ago

v0.3.5-beta1 seems to have resolved the issue here.

MJHeijster commented 2 years ago

Can also confirm that this fixes it.