derek-miller / homebridge-unifi-smartpower

Homebridge UniFi SmartPower Plugin
Apache License 2.0
7 stars 1 forks source link

failed to get status from unifi: very host,port,user name, and password are correct error code #11

Closed ray10diaz closed 1 year ago

ray10diaz commented 1 year ago

Describe Your Problem:

I get the following issue: "[12/12/2022, 12:38:34 AM] [UniFi SmartPower] Failed to get status from UniFi; verify host, port, username, and password are correct" Logs:

[12/12/2022, 12:38:34 AM] [UniFi SmartPower] Failed to get status from UniFi; verify host, port, username, and password are correct

Plugin Config: x= redacted info

{
    "bridge": {
        "name": "Homebridge ",
        "username": xxxxxxx",
        "port": 51773,
        "pin": xxxxxxx",
        "advertiser": "bonjour-hap"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "auth": "form",
            "theme": "dark-mode-blue",
            "tempUnits": "f",
            "lang": "auto",
            "platform": "config"
        },
        {
            "controllers": [
                {
                    "address": "10.xx.xx.1",
                    "password": "xxxx",
                    "username": "xxxx"
                }
            ],
            "platform": "UniFi Protect",
            "_bridge": {
                "username": "xxxx",
                "port": 46726
            }
        },
        {
            "name": "UniFi SmartPower",
            "host": "10.xx.xx.1",
            "port": 443,
            "username": "hxxxxxSP",
            "password": "xxxxxx",
            "refreshDevicesPollInterval": 600,
            "outletStatusCacheTtl": 15,
            "outletStatusPollInterval": 15,
            "platform": "UniFiSmartPower"
        }

Screenshots:

Environment:

derek-miller commented 1 year ago

Is your user assigned to a role with "Full Management" privileges to the Network application?

image
derek-miller commented 1 year ago

Please update to v0.4.2. I added some additional context to the log message that may help narrow down your issue. Also, what are you using as your UniFi console (e.g. UDM, UDM-Pro, UDM-SE, Cloud Key, Cloud Key Gen 2, etc)?

ray10diaz commented 1 year ago

Hi, sorry I didn't get a notification for your first reply. My apologies. I upgraded just now. I'm running my unifi OS on a UDM:SE. Do you know how to get the logs? Could the issue be I'm on early access firmware for my unifi OS?

ray10diaz commented 1 year ago

Okay never mind. I see error code 403. See image image

derek-miller commented 1 year ago

I double checked and a 403 could mean your username/password is incorrect (usually this a 401, but the API does not treat it this way), or the user does not have privileges to access the network application API.

ray10diaz commented 1 year ago

I changed the password and still get the same issue. Just copy and paste it when I change it. I run unifi protect on my home bridge as well with the same info and controller ip.

derek-miller commented 1 year ago

What are the permissions set to for the user you are using?

ray10diaz commented 1 year ago

I figured it out. One of my projects was to put homebridge in docker and I did. It worked when I put it on rocker. Probably there was inference with my AdGuard home. Idk what the issue could be. I figured it out at last. Thank you for your help. I really appreciate it and happy holidays

derek-miller commented 1 year ago

No worries. Glad you got it working!