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 showing upgradable devices #18

Open
whatdaybob opened this issue May 21, 2020 · 3 comments
Open

Error showing upgradable devices #18

whatdaybob opened this issue May 21, 2020 · 3 comments

Comments

@whatdaybob
Copy link

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.

@xstrex
Copy link

xstrex commented Jul 16, 2020

Chiming in, same issue! HA 0.112.4

@jjanderson
Copy link

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

@zvldz
Copy link

zvldz commented Aug 6, 2021

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:

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

4 participants