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

Unify Dream Machine Support #17

Closed
jjanderson opened this issue Apr 14, 2020 · 35 comments
Closed

Unify Dream Machine Support #17

jjanderson opened this issue Apr 14, 2020 · 35 comments

Comments

@jjanderson
Copy link

Hello,

On the new Unifi Dream Machine Pro, the controller is located at https://192.168.1.1/network/ not at port 8443.

Can this component be modified to handle the UDM Pro?

Thanks

@photoncloudio
Copy link

Unifi Dream Machine Pro support would be amazing. I have been using this unifi gateway sensor for ages. Really useful. When I upgraded to the UDMP recently I lost visibility, would be great to get this working! :)

@adandl
Copy link

adandl commented May 5, 2020

+1 :) - would love to have UnifiOS / UDM Pro support as well

@grantclem
Copy link

Would be great to have this available

@theOrakle
Copy link

+1

@mschrag
Copy link

mschrag commented Jul 24, 2020

the newer version of pyunifi lets you specify a version="unifiOS" (rather than version="v4") which appears to be compatible with the UDM when I test it locally

@grantclem
Copy link

Noticed that also, made the change in the sensor.py and still nothing. Changed the port to 443 also. Sensors are created, but all "unavailable".

@joggs
Copy link

joggs commented Jul 28, 2020

I think the url to the api on the dream machine pro is https://x.x.x.x:443/proxy/network/api/s/ instead of https://x.x.x.x:8443/api/s/

@curt7000
Copy link

+1

@Anon0511
Copy link

Anon0511 commented Oct 5, 2020

I suppose this project is dead. Just look at how old the outstanding PR is.
I tried to do the changes manually but it seems like I just don't have Python knowledge to get it working.
If anyone gets this working then please fork the project and link it.

@cdrom1028
Copy link

+1

@jchasey
Copy link
Collaborator

jchasey commented Jan 5, 2021

I don't have a Dream Machine but have made the changes which in theory should support one.

@rlust
Copy link

rlust commented Jan 5, 2021

For UDMP what version should I use?

@grantclem
Copy link

For UDMP what version should I use?

version: unifiOS

@jjanderson
Copy link
Author

I don't have a Dream Machine but have made the changes which in theory should support one.

Legend! Thanks so much, will test soonest!

@jchasey
Copy link
Collaborator

jchasey commented Jan 6, 2021

It looks like there is still an issue within the PyUnifi library that means logging into a Dream Machine does not work...please request a fix in that library and we can then inherit the fix here

@jchasey jchasey reopened this Jan 6, 2021
@b2az
Copy link

b2az commented Jan 7, 2021

Hi guys, i have a UDM-Pro.
This is my config:

sensor:

  • platform: unifigateway
    host: 10.0.1.1
    port: 443
    username: !secret unifi_user
    password: !secret unifi_password
    monitored_conditions:
    - www
    - wlan
    - alerts
    - firmware

This is the error-log:

2021-01-07 12:48:20 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for unifigateway which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2021-01-07 12:48:21 ERROR (SyncWorker_0) [custom_components.unifigateway.sensor] Failed to access health info: Expecting value: line 2 column 1 (char 1)
2021-01-07 12:48:21 ERROR (SyncWorker_4) [custom_components.unifigateway.sensor] Failed to access health info: Expecting value: line 2 column 1 (char 1)
2021-01-07 12:48:22 ERROR (SyncWorker_7) [custom_components.unifigateway.sensor] Failed to access alerts info: Expecting value: line 1 column 1 (char 0)
2021-01-07 12:48:22 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 359, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 466, in async_device_update
await task
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
2021-01-07 12:48:22 ERROR (SyncWorker_8) [custom_components.unifigateway.sensor] Failed to scan aps: Expecting value: line 2 column 1 (char 1)
2021-01-07 12:48:23 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 359, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 466, in async_device_update
await task
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 155, in update
for devices in aps:
UnboundLocalError: local variable 'aps' referenced before assignment
2021-01-07 12:48:51 ERROR (SyncWorker_13) [custom_components.unifigateway.sensor] Failed to access health info: Expecting value: line 2 column 1 (char 1)
2021-01-07 12:48:51 ERROR (SyncWorker_3) [custom_components.unifigateway.sensor] Failed to access health info: Expecting value: line 2 column 1 (char 1)

@JamieP83
Copy link

following this for UDMP updates once it works

@woodmj74
Copy link

woodmj74 commented Feb 6, 2021

following @b2az - seeing the same problem with USG Pro 4, get the sensors in HA but logs are the same as you, "failed to access health info"

@iJuiceman
Copy link

I have the same issue with a UDMP. Driving me nuts.

2021-02-13 17:14:02 ERROR (SyncWorker_1) [custom_components.unifigateway.sensor] Failed to access health info: Expecting value: line 2 column 1 (char 1)
2021-02-13 17:14:04 ERROR (SyncWorker_5) [custom_components.unifigateway.sensor] Failed to access health info: Expecting value: line 2 column 1 (char 1)
2021-02-13 17:14:05 ERROR (SyncWorker_2) [custom_components.unifigateway.sensor] Failed to access health info: Expecting value: line 2 column 1 (char 1)
2021-02-13 17:14:06 ERROR (SyncWorker_8) [custom_components.unifigateway.sensor] Failed to access alerts info: Expecting value: line 1 column 1 (char 0)

@mgottholsen
Copy link

Can confirm, also experiencing this issue with a USG4.

@guice
Copy link

guice commented Feb 27, 2021

Can't use the version key within the yaml anymore. It errors out:

Invalid config for [sensor.unifigateway]: [version] is an invalid option for [sensor.unifigateway]. Check: sensor.unifigateway->version. (See ?, line ?). 

I tried setting version: unifiOS and it won't validate.

@scarpentier
Copy link

Manually upgrading the pyunifi package to the latest development branch introduces a new UDMP-unifiOS version that fixes the issue (don't forget to specify port 443).

python -m pip install --upgrade git+https://github.com/finish06/pyunifi.git@development

No code change required from sensor.unifigateway apart from using the lastest from master branch (so version 3.0 not 2.3).

@ahmaddxb
Copy link

ahmaddxb commented Mar 1, 2021

I update to master and and did the config below.

  • platform: unifigateway
    host: 192.168.1.2
    port: 443
    version: unifiOS
    username:
    password:
    monitored_conditions:
    • vpn
    • www
    • lan
    • wan
    • wlan
    • alerts
    • firmware

I get this error but credential are correct

Logger: custom_components.unifigateway.sensor
Source: custom_components/unifigateway/sensor.py:91
Integration: unifigateway (documentation)
First occurred: 12:04:22 (1 occurrences)
Last logged: 12:04:22

Failed to connect to Unifi Security Gateway: Login failed - status code: 401

@guice
Copy link

guice commented Mar 1, 2021

@ahmaddxb - you don't seem to have a username/password set. That would be why. At the very least, we should be seeing a !secret username and password in there.

Note: based on the setup, I'm going to assume you cannot use a login with 2FA. Create a service account that has no 2FA to connect to your gateway.

@ahmaddxb
Copy link

ahmaddxb commented Mar 2, 2021

@ahmaddxb - you don't seem to have a username/password set. That would be why. At the very least, we should be seeing a !secret username and password in there.

Note: based on the setup, I'm going to assume you cannot use a login with 2FA. Create a service account that has no 2FA to connect to your gateway.

I do have a username and password I just left it blank in my config I posted here, also I'm not using 2fa.

@curt7000
Copy link

curt7000 commented Mar 3, 2021

I'm having a similar issue as @ahmaddxb , updated pyunifi, using unifigateway ver. 3.0, but getting a 401 login issue with a local user without 2FA.

@holblin
Copy link

holblin commented Mar 24, 2021

Hi, I have the same issue. UDM version is 6.0.43. I have a correct login / username but I got the same error:

2021-03-24 08:25:42 ERROR (SyncWorker_2) [custom_components.unifigateway.sensor] Failed to connect to Unifi Security Gateway: Login failed - status code: 401

This is my config:

  - platform: unifigateway
    host: 192.168.1.1
    username: a-valid-username-with-read-only-access
    password: the-matching-valid-password
    version: unifiOS
    monitored_conditions:
      - www
      - wlan
      - alerts
      - firmware

I also use the last version of the HACS plugin

@holblin holblin mentioned this issue Mar 24, 2021
@holblin
Copy link

holblin commented Mar 24, 2021

After a small research, it seems that we need the support of UDMP-unifiOS version which is currently in development and not release yet.
cf: https://github.com/finish06/pyunifi/tree/development
cf2: finish06/pyunifi#62

@jchasey
Copy link
Collaborator

jchasey commented Apr 19, 2021

Supported in latest release

@jchasey jchasey closed this as completed Apr 19, 2021
@jjanderson
Copy link
Author

jjanderson commented Apr 19, 2021

Hi,

Thanks for the update, unfortunately, this update does not seem to have resolved the issue. I was using a patched version

(https://community.home-assistant.io/t/unifi-security-gateway/71505/188) which was working, but after update (downloading and replacing the patched version with this version) I am now getting this error:

Logger: custom_components.unifigateway.sensor
Source: custom_components/unifigateway/sensor.py:183
Integration: unifigateway (documentation)
First occurred: 14:14:31 (16 occurrences)
Last logged: 14:17:03

Failed to access health info: Expecting value: line 2 column 1 (char 1) 

Here is my config:

- platform: unifigateway
  host: !secret unifi_host
  port: 443
  username: !secret unifi_ro_username
  password: !secret unifi_ro_password
  site_id: default
  monitored_conditions:
    - www
    - wlan
    - alerts
    - firmware
    - vpn
    - wan

@guice
Copy link

guice commented Apr 19, 2021

Updated and setting version: to UDMP-unifiOS now works on my end.

@jjanderson
Copy link
Author

jjanderson commented Apr 19, 2021

When I use version i get

Invalid config for [sensor.unifigateway]: [version] is an invalid option for [sensor.unifigateway]. Check: sensor.unifigateway->version.

- platform: unifigateway
  host: !secret unifi_host
  port: 443
  version: UDMP-unifiOS
  username: !secret unifi_ro_username
  password: !secret unifi_ro_password
  site_id: default
  monitored_conditions:
    - www
    - wlan
    - alerts
    - firmware
    - vpn
    - wan

@WhimsySpoon
Copy link

I too was using the patched version, but since installing the latest version from HACS (without the patch), the following config works for me:

- platform: unifigateway
  host: !secret unifi_gateway_host
  port: 443
  version: UDMP-unifiOS
  username: !secret unifi_gateway_username
  password: !secret unifi_gateway_password

@jjanderson
Copy link
Author

ok, I have it working now.... it was weird as after update, I could not restart from the UI, but commenting out version, enabled the restart, and then adding in version once back up and restarting got it working... Nice one!

@xneo1
Copy link

xneo1 commented Aug 20, 2021

I can also confirm that UDM with: version: UDMP-unifiOS also works on with Unifi OS 1.10 .

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