derek-miller / homebridge-unifi-smartpower

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

First Config no connection to host #12

Closed cameronpalm closed 1 year ago

cameronpalm commented 1 year ago

Configuring SmartPower plugin for first use. Unable to see any devices on network. I have PDU Pro, 6 port strip, & Plug. None of which appear in homekit. I have everything running on a Synology DSM connected to a unifi dream machine pro. The setup is configured for an admin. See screenshot for roles assigned to homebridge user.

Logs:

[12/11/2022, 1:44:43 PM] [HB Supervisor] Restarting Homebridge...
[12/11/2022, 1:44:43 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /volume1/homebridge/node_modules --strict-plugin-resolution
[12/11/2022, 1:44:43 PM] [HB Supervisor] Started Homebridge v1.6.0 with PID: 6974
[12/11/2022, 1:44:44 PM] Loaded config.json with 0 accessories and 3 platforms.
[12/11/2022, 1:44:44 PM] Loaded 2 cached accessories from cachedAccessories.
[12/11/2022, 1:44:44 PM] ---
[12/11/2022, 1:44:45 PM] Loaded plugin: homebridge-unifi-protect@5.5.4
[12/11/2022, 1:44:45 PM] Registering platform 'homebridge-unifi-protect.UniFi Protect'
[12/11/2022, 1:44:45 PM] ---
[12/11/2022, 1:44:45 PM] Loaded plugin: homebridge-unifi-smartpower@0.4.1
[12/11/2022, 1:44:45 PM] Registering platform 'homebridge-unifi-smartpower.UniFiSmartPower'
[12/11/2022, 1:44:45 PM] ---
[12/11/2022, 1:44:45 PM] Loading 3 platforms...
[12/11/2022, 1:44:45 PM] [UniFi Protect] Initializing UniFi Protect platform...
[12/11/2022, 1:44:45 PM] [UniFi SmartPower] Initializing UniFiSmartPower platform...
Setup Payload:
X-HM://00253UGVI52TH
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
    │ 989-53-198 │     
    └────────────┘     

[12/11/2022, 1:44:45 PM] Homebridge v1.6.0 (HAP v0.11.0) (Homebridge 1D76) is running on port 51265.
[12/11/2022, 1:44:46 PM] [UniFi Protect] Palm Gate [UDM-PRO-SE]: Connected to the UniFi Protect controller API (address: 192.168.1.1 mac: 602232287219).
[12/11/2022, 1:44:46 PM] [UniFi Protect] Palm Gate [UDM-PRO-SE]: Connected to the UniFi Protect realtime update events API.
[12/11/2022, 1:44:46 PM] [UniFi Protect] Palm Gate [UDM-PRO-SE]: Discovered camera: Bedroom [UVC G3 Flex] (address: 192.168.1.143 mac: 70A7410D97FE).
[12/11/2022, 1:44:46 PM] [UniFi Protect] Palm Gate [UDM-PRO-SE]: Discovered camera: Living Room [UVC G3 Flex] (address: 192.168.1.90 mac: 70A7410D9397).
[12/11/2022, 1:44:46 PM] [UniFi Protect] Palm Gate [UDM-PRO-SE]: Controller refresh interval set to 10 seconds.
[12/11/2022, 1:44:46 PM] [UniFi Protect] Palm Gate [UDM-PRO-SE] Bedroom [UVC G3 Flex]: HomeKit Secure Video support enabled.
[12/11/2022, 1:44:46 PM] [UniFi Protect] Palm Gate [UDM-PRO-SE] Living Room [UVC G3 Flex]: HomeKit Secure Video support enabled.
[12/11/2022, 1:44:46 PM] [UniFi SmartPower] Failed to get status from UniFi; verify host, port, username, and password are correct

Plugin Config:

{
    "bridge": {
        "name": "Homebridge 1D76",
        "username": "0E:37:CF:E3:3E:A8",
        "port": 51265,
        "pin": "989-53-198",
        "advertiser": "bonjour-hap"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "platform": "config"
        },
        {
            "controllers": [
                {
                    "address": "192.168.1.1",
                    "name": "palmgate",
                    "password": "*********",
                    "username": "homebridge"
                }
            ],
            "platform": "UniFi Protect"
        },
        {
            "name": "UniFi SmartPower",
            "host": "192.168.1.1",
            "port": 443,
            "username": "homebridge",
            "password": "*******",
            "refreshDevicesPollInterval": 600,
            "outletStatusCacheTtl": 15,
            "outletStatusPollInterval": 15,
            "platform": "UniFiSmartPower"
        }
    ]
}

Screenshots:

https://www.dropbox.com/s/13nld371ixj7nn2/Screenshot%202022-12-11%20at%208.17.59%20PM.png?dl=0

Environment:

cjsfj commented 1 year ago

Did you happen to grant the homebridge user "full management" access to Unifi Network? This is not the same privilege as Unifi Protect. I had the same issue with the same error and had neglected to do this.

derek-miller commented 1 year ago

As @cjsfj mentioned, make sure your user is assigned to a role with "Full Management" privileges to the Network application. Let me know if this does not fix the issue.

image
cameronpalm commented 1 year ago

it appears to be configured correctly.

On Dec 13, 2022, at 10:15 AM, Derek Miller @.***> wrote:

As @cjsfj https://github.com/cjsfj mentioned, make sure your user is assigned to a role with "Full Management" privileges to the Network application. Let me know if this does not fix the issue. https://user-images.githubusercontent.com/1340081/207371280-b95a907e-5aec-427a-bd67-a871898e7646.png — Reply to this email directly, view it on GitHub https://github.com/derek-miller/homebridge-unifi-smartpower/issues/12#issuecomment-1348777009, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD6DCOQP3FWD5I6MJH2TPWLWNCHJHANCNFSM6AAAAAAS3K2C4U. You are receiving this because you authored the thread.

Cameron Palm 915-342-0954 @.***

derek-miller commented 1 year ago

Also verify you can load the console on the IP and port set in the config and login with the username/password. In your case, https://192.168.1.1/

cameronpalm commented 1 year ago

I can access at the IP using the homebridge credentials, but when I specify the prot 443 it doesn’t connect. Did i miss something in the documentation about configuring a specific port access on the unifi side?

On Dec 13, 2022, at 12:19 PM, Derek Miller @.***> wrote:

Also verify you can load the console on the IP and port set in the config and login with the username/password. In your case, https://192.168.1.1/

— Reply to this email directly, view it on GitHub https://github.com/derek-miller/homebridge-unifi-smartpower/issues/12#issuecomment-1349133826, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD6DCOXAIKRU7ESTV6EUV7LWNCVY5ANCNFSM6AAAAAAS3K2C4U. You are receiving this because you authored the thread.

Cameron Palm 915-342-0954 @.***

derek-miller commented 1 year ago

What port do you use to access the console in a browser?

cameronpalm commented 1 year ago

Since I don’t have a valid certificate installed, it would have to be HTTP protocol, port 80. 443, would be https. I changed the homebridge for smartpower to connect to 80 instead of 443. It still didn’t work. Unifi protect login still works with the same homebridge admin credentials.

/c

On Dec 13, 2022, at 3:16 PM, Derek Miller @.***> wrote:

What port do you use to access the console in a browser?

— Reply to this email directly, view it on GitHub https://github.com/derek-miller/homebridge-unifi-smartpower/issues/12#issuecomment-1349630749, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD6DCOSGHUATVBQMPG2EFCLWNDKRRANCNFSM6AAAAAAS3K2C4U. You are receiving this because you authored the thread.

Cameron Palm 915-342-0954 @.***

derek-miller commented 1 year ago

IP addresses don’t have certs and SSL verification is turned off in the plugin’s client. I would suggest making a new user and ensure it has full management privileges.

cameronpalm commented 1 year ago

Didn’t work. I made a dedicated user for the smartpower, gave it same permissions as my main account, and it still throws the same error.

On Dec 13, 2022, at 4:28 PM, Derek Miller @.***> wrote:

IP addresses don’t have certs and SSL verification is turned off in the plugin’s client. I would suggest making a new user and ensure it has full management privileges.

— Reply to this email directly, view it on GitHub https://github.com/derek-miller/homebridge-unifi-smartpower/issues/12#issuecomment-1349749789, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD6DCOTAA7HKCOYZRVVQUB3WNDTBPANCNFSM6AAAAAAS3K2C4U. You are receiving this because you authored the thread.

Cameron Palm 915-342-0954 @.***

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)?

cameronpalm commented 1 year ago

UDM PRO SE, with a homebridge running from a synology with a fixed IP within the local LAN. Updated below are the logs:

[12/16/2022, 5:30:35 PM] [HB Supervisor] Restarting Homebridge... [12/16/2022, 5:30:35 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /volume1/homebridge/node_modules --strict-plugin-resolution [12/16/2022, 5:30:35 PM] [HB Supervisor] Started Homebridge v1.6.0 with PID: 4819 [12/16/2022, 5:30:36 PM] Loaded config.json with 0 accessories and 3 platforms. [12/16/2022, 5:30:36 PM] Loaded 3 cached accessories from cachedAccessories. [12/16/2022, 5:30:36 PM] --- [12/16/2022, 5:30:37 PM] Loaded plugin: @. [12/16/2022, 5:30:37 PM] Registering platform 'homebridge-unifi-protect.UniFi Protect' [12/16/2022, 5:30:37 PM] --- [12/16/2022, 5:30:37 PM] Loaded plugin: @. [12/16/2022, 5:30:37 PM] Registering platform 'homebridge-unifi-smartpower.UniFiSmartPower' [12/16/2022, 5:30:37 PM] --- [12/16/2022, 5:30:37 PM] Loading 3 platforms... [12/16/2022, 5:30:37 PM] [UniFi Protect] Initializing UniFi Protect platform... [12/16/2022, 5:30:37 PM] [UniFi SmartPower] Initializing UniFiSmartPower platform... Setup Payload: X-HM://00253UGVI52TH Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

[12/16/2022, 5:30:37 PM] Homebridge v1.6.0 (HAP v0.11.0) (Homebridge 1D76) is running on port 51265. [12/16/2022, 5:30:38 PM] [UniFi Protect] Palm Gate [UDM-PRO-SE]: Connected to the UniFi Protect controller API (address: 192.168.1.1 mac: 602232287219). [12/16/2022, 5:30:38 PM] [UniFi Protect] Palm Gate [UDM-PRO-SE]: Connected to the UniFi Protect realtime update events API. [12/16/2022, 5:30:38 PM] [UniFi Protect] Palm Gate [UDM-PRO-SE]: Discovered camera: Bedroom [UVC G3 Flex] (address: 192.168.1.143 mac: 70A7410D97FE). [12/16/2022, 5:30:38 PM] [UniFi Protect] Palm Gate [UDM-PRO-SE]: Discovered camera: Living Room [UVC G3 Flex] (address: 192.168.1.90 mac: 70A7410D9397). [12/16/2022, 5:30:38 PM] [UniFi Protect] Palm Gate [UDM-PRO-SE]: Discovered camera: G3 Instant [UVC G3 Instant] (address: 192.168.1.102 mac: D021F9992C93). [12/16/2022, 5:30:38 PM] [UniFi Protect] Palm Gate [UDM-PRO-SE]: Controller refresh interval set to 10 seconds. [12/16/2022, 5:30:38 PM] [UniFi Protect] Palm Gate [UDM-PRO-SE] Bedroom [UVC G3 Flex]: HomeKit Secure Video support enabled. [12/16/2022, 5:30:38 PM] [UniFi Protect] Palm Gate [UDM-PRO-SE] Living Room [UVC G3 Flex]: HomeKit Secure Video support enabled. [12/16/2022, 5:30:38 PM] [UniFi Protect] Palm Gate [UDM-PRO-SE] G3 Instant [UVC G3 Instant]: HomeKit Secure Video support enabled. [12/16/2022, 5:30:38 PM] [UniFi SmartPower] Failed to get status from UniFi; verify host, port, username, and password are correct: (intermediate value).filter is not a function

On Dec 16, 2022, at 3:58 PM, Derek Miller @.***> wrote:

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)?

— Reply to this email directly, view it on GitHub https://github.com/derek-miller/homebridge-unifi-smartpower/issues/12#issuecomment-1355595782, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD6DCOVTWYIJECY5L7EHNPTWNTJV7ANCNFSM6AAAAAAS3K2C4U. You are receiving this because you authored the thread.

Cameron Palm 915-342-0954 @.***

derek-miller commented 1 year ago

I just published v0.4.3 that will include the full stack trace of the error you are hitting. Please update and report the log.

cameronpalm commented 1 year ago

Well that seemed to work. No error was thrown and now I see all the outlets in home kit. Will post log file in a minute from my computer. Below are screen shots from HomeKit. Sent from my iPhoneOn Dec 17, 2022, at 3:55 PM, Derek Miller @.***> wrote: I just published v0.4.3 that will include the full stack trace of the error you are hitting. Please update and report the log.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>