BaQs / pyEzviz

Python package for ezviz cameras
Apache License 2.0
105 stars 45 forks source link

'NoneType' object has no attribute 'get' #45

Closed uvjim closed 3 years ago

uvjim commented 3 years ago

Seeing this in the logs of Home Assistant. I'm raising here because the error is being thrown in this library rather than the add-on.

This error originated from a custom integration.

Logger: custom_components.ezviz_cloud.coordinator
Source: custom_components/ezviz_cloud/coordinator.py:32
Integration: Ezviz(Beta)
First occurred: 21:01:35 (1 occurrences)
Last logged: 21:01:35

Unexpected error fetching ezviz_cloud data: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/ezviz_cloud/coordinator.py", line 38, in _async_update_data
    return await self.hass.async_add_executor_job(self._update_data)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/ezviz_cloud/coordinator.py", line 32, in _update_data
    return self.ezviz_client.load_cameras()
  File "/usr/local/lib/python3.9/site-packages/pyezviz/client.py", line 398, in load_cameras
    devices = self._get_all_device_infos()
  File "/usr/local/lib/python3.9/site-packages/pyezviz/client.py", line 470, in _get_all_device_infos
    result[device["deviceSerial"]]["cloudInfos"] = devices.get(
AttributeError: 'NoneType' object has no attribute 'get'
uvjim commented 3 years ago

Seems to have been fixed with https://github.com/BaQs/pyEzviz/commit/ac1968dd2dc8957124a31ec7f56db22ec1d3a2c7