pawkakol1 / worlds-air-quality-index

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

Error occurred while fetching data #43

Closed holdestmade closed 12 months ago

holdestmade commented 1 year ago

Not sure if this is due to a recent update but this integration goes offline frequently, logs below

WAQI Version: 1.0.2 HA Version: 2023.7.2

Logger: custom_components.worlds_air_quality_index.waqi_api
Source: custom_components/worlds_air_quality_index/waqi_api.py:61
Integration: World's Air Quality Index ([documentation](https://github.com/pawkakol1/worlds-air-quality-index), [issues](https://github.com/pawkakol1/worlds-air-quality-index/issues))
First occurred: 09:12:10 (1 occurrences)
Last logged: 09:12:10

Error occurred while fetching data: ConnectionError(MaxRetryError("HTTPSConnectionPool(host='api.waqi.info', port=443): Max retries exceeded with url: /feed/@3181/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xffff2f30xxxx>: Failed to establish a new connection: [Errno 101] Network unreachable'))"))
Logger: homeassistant.helpers.entity
Source: custom_components/worlds_air_quality_index/sensor.py:179
Integration: World's Air Quality Index ([documentation](https://github.com/pawkakol1/worlds-air-quality-index), [issues](https://github.com/pawkakol1/worlds-air-quality-index/issues))
First occurred: 09:03:30 (23 occurrences)
Last logged: 09:16:30

Update for sensor.air_quality_index fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 695, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.11/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 179, in update
    if self._data["data"]["aqi"] == "-":
       ~~~~~~~~~~^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
Logger: homeassistant.helpers.entity
Source: custom_components/worlds_air_quality_index/sensor.py:190
Integration: World's Air Quality Index ([documentation](https://github.com/pawkakol1/worlds-air-quality-index), [issues](https://github.com/pawkakol1/worlds-air-quality-index/issues))
First occurred: 09:03:30 (115 occurrences)
Last logged: 09:16:30

Update for sensor.particulate_matter_pm10 fails
Update for sensor.particulate_matter_pm25 fails
Update for sensor.nitrogen_dioxide_no2 fails
Update for sensor.ozone_o3 fails
Update for sensor.sulphur_dioxide_so2 fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 695, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.11/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 190, in update
    self._state = float(self._data["data"]["iaqi"][self._resType]["v"])
                        ~~~~~~~~~~^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
thewan056 commented 1 year ago

+1 I am seeing this same problem

pawkakol1 commented 1 year ago

@holdestmade / @thewan056 is it still occur?