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

Cant get all sensors to show

Open hwikene opened this issue 6 years ago • 5 comments

Hi! I am using HA 85.1 on Docker and trying to get this component to work. All i get i this error:

2019-01-15 23:35:12 ERROR (MainThread) [homeassistant.components.sensor] unifigateway: Error on device update!
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 315, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/sensor/unifigateway.py", line 159, in update
    for devices in aps:
UnboundLocalError: local variable 'aps' referenced before assignment
2019-01-15 23:35:39 ERROR (SyncWorker_4) [custom_components.sensor.unifigateway] Failed to access health info: api.err.NoSiteContext

Here is my code:

sensor:
  - platform: unifigateway
    host: 192.168.1.12
    username: user
    password: pass
    site_id: id
    monitored_conditions:
      - www
      - wlan
      - alerts
      - firmware

Here is a picture of sensors i got.. but the only show "unknown" skjermbilde 2019-01-15 kl 23 36 45

hwikene avatar Jan 15 '19 22:01 hwikene

I think you've set it up wrong. Still running on HA 85.1? Since HA 88 it's setup different.

Your python script is in the sensors folder: /config/custom_components/sensor/unifigateway.py

But al the scripts should be in it's own folder: %HA_config_folder%/custom_components/unifigateway/manifest.json %HA_config_folder%/custom_components/unifigateway/init.py %HA_config_folder%/custom_components/unifigateway/sensor.py

renedis avatar May 29 '19 11:05 renedis

This is the key error:

Failed to access health info:

For some reason you can successfully log into the controller, but the API call to the health info does not successfully return any data. Restarting HA usually fixes the problem.

I have switched to a Cloud Key Gen 2 and have not had this problem occur since then so I suspect it may be connected with the slower CK not being able to respond successfully.

jchasey avatar Jun 14 '19 16:06 jchasey

Hi @renedis, did you fix it ? I am having the same issue and reboot did not work.

gw1gw1 avatar Jan 10 '20 22:01 gw1gw1

Also having exact same issue. Hassio 0.104.3. Here are logs

Failed to access health info: api.err.NoSiteContext 2:58 AM custom_components/unifigateway/sensor.py (ERROR) - message first occurred at 2:57 AM and shows up 8 times Failed to perform <function Controller._read at 0x7f172fd5ff80> due to api.err.NoSiteContext 2:58 AM custom_components/unifigateway/sensor.py (WARNING) - message first occurred at 2:57 AM and shows up 9 times unifigateway: Error on device update! 2:57 AM custom_components/unifigateway/sensor.py (ERROR) Failed to scan aps: api.err.NoSiteContext 2:57 AM custom_components/unifigateway/sensor.py (ERROR) Error doing job: Unclosed client session 2:57 AM core.py (ERROR) - message first occurred at 2:57 AM and shows up 2 times unifigateway: Error on device update! 2:57 AM custom_components/unifigateway/sensor.py (ERROR) Failed to access alerts info: api.err.NoSiteContext 2:57 AM custom_components/unifigateway

squireblackdens avatar Jan 29 '20 03:01 squireblackdens

More detailed log

Wed Jan 29 2020 03:03:13 GMT+0000 (Greenwich Mean Time) unifigateway: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 299, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, 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 240, 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

squireblackdens avatar Jan 29 '20 03:01 squireblackdens