ebaauw / homebridge-hue

Homebridge plugin for Philips Hue
Apache License 2.0
901 stars 91 forks source link

Fresh Install API Error: Unauthorised User #1158

Closed philippmeixner closed 1 year ago

philippmeixner commented 1 year ago

Issue

Homebridge fails to start with authorisation errors in log.

I had homebridge hue running on my Raspberry for years, now I'm setting it up on my Truenas Scale machine in a docker container. Since I experienced this issue when restoring from my backup, I tried to do a fresh install of homebridge and the hue plugin, but I still have the same error.

After the fresh install, the plugin asked me to put the generated user info in the config and restart. After that the authorisation error is thrown on startup. I tested my other plugins (shelly, tp-link) separately which work without issue (found existing accessories and can control them).

I don't remember having to do any hue user configuration on my Raspberry setup, and there also is no 'user' entry in my old hue platform config. My Raspberry instance still works fine (was unplugged when setting up new instance).

The container has a static IP and I can access the web UI just fine.

Log Messages

[6/11/2023, 7:46:21 PM] [Hue] Philips hue: Signify Netherlands B.V. BSB002 bridge v1958077010, api v1.58.0
[6/11/2023, 7:46:21 PM] [Hue] Philips hue: warning: not using recommended Hue bridge api version 1.57.0
[6/11/2023, 7:46:21 PM] [Hue] Philips hue: request 1: GET /
[6/11/2023, 7:46:21 PM] [Hue] Philips hue: request 1: 200 OK
[6/11/2023, 7:46:21 PM] [Hue] Philips hue: request 1: /: api error 1: unauthorized user
[6/11/2023, 7:46:21 PM] [Hue] Philips hue: /: api error 1: unauthorized user - retrying in 15s
{
    "bridge": {
        "name": "Homebridge 283E",
        "username": "0E:B3:E9:25:28:3E",
        "port": 51022,
        "pin": "899-86-649",
        "advertiser": "bonjour-hap"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "platform": "config"
        },
        {
            "name": "Hue",
            "anyOn": true,
            "effects": true,
            "hosts": [
                "10.0.10.10"
            ],
            "users": {
                "ECB5FAFFFE8CCD29": "undefined"
            },
            "nativeHomeKitLights": true,
            "nativeHomeKitSensors": true,
            "resource": true,
            "platform": "Hue"
        }
    ]
}

Debug Files

Error - Homebridge Hue dump file does not exist yet.

homebridge.log.txt

philippmeixner commented 1 year ago

I just found a fix for my issue. When I started my old raspberry back up, it asked me to press the button on the the hue bridge (as always after a reboot). It then showed me a full username:password pair in the logs, whereas the docker instance would have the password 'undefined'.

I copied the password over and added the hosts info, after which the docker instance was able to connect to my hue bridge. Unfortunately I have to re-link the new instance to homekit, but at least it should be working now.