elad-bar / ha-edgeos

Integration with EdgeOS (Ubiquiti)
133 stars 24 forks source link

Integration fails to load after upgrading to v1.1.4 #53

Closed shlomki closed 3 years ago

shlomki commented 3 years ago

Started happening right after upgrading to v1.1.4 All devices appear as disconnected, seems that the integration is failing to load.

2021-08-23 22:26:06 ERROR (MainThread) [custom_components.edgeos.managers.data_manager] Failed to initialize EdgeOS Manager, Error: 'NoneType' object is not subscriptable, Line: 122

2021-08-23 22:26:12 ERROR (MainThread) [custom_components.edgeos.clients.web_api] Failed to login, Error: Server disconnected, Line: 109

elad-bar commented 3 years ago

Which version of EdgeOS are you using?

shlomki commented 3 years ago

v2.0.8 I'll try to get some logs soon and will share here if anything comes up

shlomki commented 3 years ago

@elad-bar Looks like you're looking at the wrong key inside system_info_data. You're trying to get the fw-latest key but it's not present in the dict.

I've printed it to the log: system_info_data = {"sw_ver": "EdgeRouter.ER-e300.v2.0.8-hotfix.1.5278088.200305.1641", "unms": {"daemon": "Not running", "status": "", "last": ""}}

shlomki commented 3 years ago

I think that the fix should be:

  1. Check for the version in both ways (in fw-latest as well as sw_ver)
  2. If version wasn't extracted after all, print a warning message and try to load anyway.
elad-bar commented 3 years ago

That's weird, I have fw_ver as well, will fix it tomorrow, thanks

shlomki commented 3 years ago

fw_ver or sw_ver? Make sure to not have a typo ;) Looks like you might need to do some string parsing for sw_ver, might be tricky to get it right everytime.

elad-bar commented 3 years ago

No typo, meant what I wrote, The object contains a string of sw_ver, unms object and fw_ver object with version as string

shlomki commented 3 years ago

Oh, my object doesn't contain fw_ver, only sw_ver. Which version are you using? And which router?

Mine is Edgerouter 12

elad-bar commented 3 years ago

my bad, it's not fw_ver but fw_latest image

it seems that it was added in v2.0.9, I will use the sw_ver if the fw_latest is not available and will release a new version