sensor.unifigateway icon indicating copy to clipboard operation
sensor.unifigateway copied to clipboard

Error showing upgradable devices

Open whatdaybob opened this issue 5 years ago • 3 comments

I receive this every time HA restarts.

This means that HA no longer can see upgradable devices

2020-05-20 23:53:08 ERROR (MainThread) [homeassistant.components.sensor] unifigateway: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 322, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 472, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 239, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/unifigateway/sensor.py", line 157, in update
    self._attributes[devices['name']] = devices['upgradable']
KeyError: 'name' 

All other sensors appear to be fine.

Happy to help diagnose where I can.

whatdaybob avatar May 21 '20 00:05 whatdaybob

Chiming in, same issue! HA 0.112.4

xstrex avatar Jul 16 '20 22:07 xstrex

Same here... is this repo being worked on at all or is it DOA?

2020-08-27 11:27:14 ERROR (SyncWorker_42) [custom_components.unifigateway.sensor] Failed to access health info: Expecting value: line 2 column 1 (char 1)
2020-08-27 11:27:14 ERROR (SyncWorker_53) [custom_components.unifigateway.sensor] Failed to access alerts info: Expecting value: line 1 column 1 (char 0)
2020-08-27 11:27:15 ERROR (MainThread) [homeassistant.components.sensor] unifigateway: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 335, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 456, in async_device_update
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 239, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/unifigateway/sensor.py", line 139, in update
    for index, alert in enumerate(unarchived_alerts,start=1):
UnboundLocalError: local variable 'unarchived_alerts' referenced before assignment

jjanderson avatar Aug 27 '20 11:08 jjanderson

fix

--- sensor.py.orig      2021-08-06 17:18:15.862765406 +0300
+++ sensor.py   2021-08-06 17:18:29.926554823 +0300
@@ -160,7 +160,7 @@
             # but is user-readability preferred
             for devices in aps:
               if devices.get('upgradable'):
-                  self._attributes[devices['name']] = devices['upgradable']
+                  self._attributes[devices['ip']] = devices['upgradable']
                   self._state += 1
 
         else:

zvldz avatar Aug 06 '21 14:08 zvldz