UniFi Security Gateway

Will there be a manifest key version fix?

Sorry guys, busy at work so not much time to sort issues. Just merged pull request to fix manifest key.

1 Like

Hi John! Thanks so much for your efforts. Can you push a new release in Github? The last release is 0.2.3 so that is what comes up in HACS. Until a new release is tagged in Github your latest changes won’t be available in HACS.

New release pushed!

3 Likes

@jchasey, awesome! and thanks for the new release. After reviewing the release notes I did have one question, does this ver. now work correctly with UnifiOS and UDM-Pro?

In case someone still having issues with the component not reading the data but logs in successfully to the controller (no login error).

I dug deep into this today and discovered that the controller requires bearer token authentication for each API request. The token is provided as a cookie while logged in.

This should be handled in the pyunifi repo that this component depends on.

I created a modification that handles this properly as a fork of pyunifi. I also created a pull request for this.

Until it get’s resolved, merged and released (It seems that the repo is kind of stale) here is how to make this component work with it:

Open the manifest.json file in custom-components/unifigateway and update the requirements:

"requirements": [
      "https://github.com/swingerman/pyunifi/archive/refs/tags/2.20.7.zip#package==2.20.7"
],

Note: this is just a temporary solution and any update to this repo will revert this.

Also, make sure that you set port 8443 in your config as the default seemed to change to 443. Make sure you only use version: unifiOS for udm pro machines.

hello this is my manifest.yaml but no sensor coming up :frowning:

{
        "domain": "unifigateway",
        "name": "UniFi Gateway",
        "documentation": "https://github.com/custom-components/sensor.unifigateway",
        "requirements": ["https://github.com/swingerman/pyunifi/archive/refs/tags/2.20.7.zip#package==2.20.7"],
        "version": "0.3.2",
        "dependencies": [],
        "codeowners": ["@jchasey"]
}

and this my congif:

- platform: unifigateway
  host: 192.168.1.1
  port: 443
  username: xxx
  password: xxx

Please try with port 8443

Even if I access my controller with 443?

Nope, then it should be 443. What do yiu see in the logs?

@swingerman what Unifi solution are you using? Are you on UDM-Pro?

I’m using USG.

as an FYI, I replied to you in the issue I created (#37) about errors I was getting using this custom integration.

You referenced that issue in the PR #63 so I wanted to let you know that I’m still getting those errors after modifying the requirements as you posted above so I don’t think that was the fix.

unless I have done something incorrectly.

I’m also using a USG

Guys, USG is just the router/FW. What controller are you using? CloudKey (with Unifi), Gen2+ (UnifiOS), etc. This all matters because with UnifiOS, Ubiquity inserted a proxy component to manage SSL and allow multiple Network Services via a single IP address and Port.

When I used the older version of Unifi this component worked well, but Since UnifiOS has changed the access model and internal paths to components, and because this custom component is not being validated for all deployment possibilities we will continue to have confusion on how to make this work.

My setup (UDM-Pro) is working well with the addition of the files shared by @grantc HERE.

yes, I can confirm @grantc files working great for UDM Pro…

Yeah, your right. Didn’t think before adding that.

I’m using a cloudkey Gen2 running UnifiOS and getting errors.

2021-03-27 19:32:00 ERROR (SyncWorker_21) [custom_components.unifigateway.sensor] Failed to access health info: Expecting value: line 2 column 1 (char 1)
2021-03-27 19:32:01 ERROR (SyncWorker_12) [custom_components.unifigateway.sensor] Failed to access alerts info: Expecting value: line 1 column 1 (char 0)
2021-03-27 19:32:01 ERROR (SyncWorker_28) [custom_components.unifigateway.sensor] Failed to access health info: Expecting value: line 2 column 1 (char 1)
2021-03-27 19:32:01 ERROR (SyncWorker_2) [custom_components.unifigateway.sensor] Failed to scan aps: Expecting value: line 2 column 1 (char 1)
2021-03-27 19:32:01 ERROR (SyncWorker_7) [custom_components.unifigateway.sensor] Failed to access health info: Expecting value: line 2 column 1 (char 1)
2021-03-27 19:32:01 ERROR (SyncWorker_43) [custom_components.unifigateway.sensor] Failed to access health info: Expecting value: line 2 column 1 (char 1)
2021-03-27 19:32:01 ERROR (SyncWorker_15) [custom_components.unifigateway.sensor] Failed to access health info: Expecting value: line 2 column 1 (char 1)

Per the issue filed above.

Im using CloudKey Gen2+. It runs on UnifyOS. But it won’t work with the UnifOs setting for this component as it changes the API endpoint path to a proxy one that fails as it only should be used on UDM and not on CloudKey.
I create a small postman collection to test it: https://www.getpostman.com/collections/1786db8653d2a7aa3ea2

I get this error on my UDMP:

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

I have setup a user, and I can login with that user in webportal

- platform: unifigateway
  host: 192.168.1.1
  port: 443
  username: ha
  password: xxxxx
  monitored_conditions:
    - www
    - wlan
    - alerts
    - firmware

try adding

version: UDMP-unifiOS

1 Like

This did the trick. Thank you

1 Like