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

v0.14.3 not working getting the following messages #1196

Closed
ruudbol opened this issue Nov 9, 2024 · 18 comments
Closed

v0.14.3 not working getting the following messages #1196

ruudbol opened this issue Nov 9, 2024 · 18 comments
Labels

Comments

@ruudbol
Copy link

ruudbol commented Nov 9, 2024

After update I get the following messages.
[09/11/2024, 12:05:15] [Hue] homebridge-hue v0.14.3, node v22.11.0, homebridge v1.8.5
[09/11/2024, 12:05:15] [Hue] config.json: effects: invalid key
[09/11/2024, 12:05:15] [Hue] Hue Bridge: Signify Netherlands B.V. BSB002 bridge v1967054020, api v1.67.0
[09/11/2024, 12:05:16] [Hue] Hue Bridge: request 3: GET /button
[09/11/2024, 12:05:16] [Hue] Hue Bridge: request 3: http status 404 Not Found
[09/11/2024, 12:05:16] [Hue] Hue Bridge: http status 404 Not Found - retrying in 15s

downgrade to v0.14.2 for now, no problem.

@ebaauw
Copy link
Owner

ebaauw commented Nov 9, 2024

Do you have any switches connected to your Hue bridge?

What's the output of ph -DD -H ... get /button, substituting the IP address of your Hue bridge?

@ebaauw
Copy link
Owner

ebaauw commented Nov 9, 2024

Sorry, I meant a wireless switch, like the Hue dimmer switch, Hue smart button, Hue tap dial switch, Hue tap switch, Hue wall switch module, or a Friends-of-Hue switch.

Never mind the DEBUG mode (it won't show the info I need); but please run the ph -DD -H ... get /button.

@ruudbol
Copy link
Author

ruudbol commented Nov 9, 2024 via email

@ruudbol
Copy link
Author

ruudbol commented Nov 9, 2024

IMG_0554

@ebaauw
Copy link
Owner

ebaauw commented Nov 10, 2024

You need to press the button on the Hue bridge and within 60s issue ph -H 192.168.178.20 getApiKey for ph to obtain an API key. ph automatically stores the key in ~/.ph. Homebridge Hue cannot store its API key automatically, hence the instruction to edit config.json manually and store the API key there.

@herbertblom
Copy link

herbertblom commented Nov 10, 2024 via email

@ebaauw
Copy link
Owner

ebaauw commented Nov 10, 2024

ph and Homebridge Hue each use their own API key (aka username). For Homebridge Hue, see https://github.com/ebaauw/homebridge-hue?tab=readme-ov-file#installation; for ph, see https://github.com/ebaauw/homebridge-hue/wiki/ph-Tutorial#obtaining-an-api-key. Note that as of v0.14.3, username has been replaced with the more accurate apiKey, so it's ph getApiKey instead of ph createuser

@ruudbol
Copy link
Author

ruudbol commented Nov 11, 2024 via email

@ebaauw
Copy link
Owner

ebaauw commented Nov 11, 2024

I have got a username/api for ph but everytime I push the hue button it gives me a different apikey.

Yes, every time an API clients requests an API key from the Hue bridge, a new API key is generated. This enables the Hue bridge to keep track of the different API clients. That why the API key needs to be persisted, or you would have to press the Hue bridge key everything you start Homebridge Hue (or with every ph command). Homebridge Hue persists the API key in config.json; unfortunately that needs to be maintained manually (as config.json should not be writeable from Homebridge). ph persists the key automatically in ~/.ph.

All this has little to do with the "http status 404 Not Found" issue. I need to see exactly what Homebridge Hue (or ph) sends to the Hue bridge, and what the Hue bridge responds.

        "forceHttp": true,

Why do you have this set? I think this might actually be causing the issue, as the GET of /button is an API v2 call, which only works over https. Still a bug that Homebridge Hue won't continue without using the event stream. v0.14.2 uses a separate API client for this v2 call, which would use htttps irrespective of the setting, but v0.14.3 uses the updated HueClient that supports both API versions. If you didn't see any errors in v0.14.2, https works, and you shouldn't be setting forceHttp anyways.

@ebaauw
Copy link
Owner

ebaauw commented Nov 11, 2024

v0.14.4 will not try to use the event stream when forceHttp has been set (as the event stream is part of the v2 API, it only works over HTTPS). This should solve this issue, but will lead to sluggish performance, especially on button presses. One could argue that version before v0.14.3 actually had a bug, in that forceHttp wasn't fully honoured.

Morale: don't set forceHttp. That's why it's under the Advanced Settings that you shouldn't change.

Also, I've added a -f or --forceHttp flag to ph for debugging.

@ebaauw ebaauw added the bug label Nov 11, 2024
@ruudbol
Copy link
Author

ruudbol commented Nov 11, 2024 via email

@ebaauw
Copy link
Owner

ebaauw commented Nov 11, 2024

I guess that would be the reason why you set forceHttp. Looks like the NodeJS installation on your system isn’t compatible with the SSL version. I’m afraid that’s beyond me. Did you have a similar message with v0.14.2 without forceHttp? Do you see the same error for ph? If not: Are you running Homebridge Hue in a separate child bridge? and: Did you re-install Homebridge and Homebridge Config UI X after upgrading to NodeJS v22?

You can still set forceHttp in v0.14.4 and use an aggressive heartbeat setting to mitigate the sluggyness.

@ruudbol
Copy link
Author

ruudbol commented Nov 11, 2024 via email

@ebaauw
Copy link
Owner

ebaauw commented Nov 11, 2024

There is something wrong with your system that breaks SSL support from NodeJS. SSL is used for HTTPS, which the Hue bridge requires for the API v2. This is not caused by Homebridge Hue, and cannot be solved by Homebridge Hue. As a workaround, you can set forceHttp to make Homebridge Hue not use HTTPS, but then it cannot use the event stream. This workaround will not work for Homebridge Hue2.

@herbertblom
Copy link

herbertblom commented Nov 11, 2024

I think 0.14.6 is a beautiful number.
That did it for me, just like 0.14.2 did.
Thanks.
Herbert

@ebaauw ebaauw closed this as completed Nov 20, 2024
@oleschaper
Copy link

I had the exact same issue, thanks for looking into it and the fix!
Also the same error message regarding SSL when setting forceHttp to false.
In my case the reason was due a hardcoded port 80 in the hosts settings (I don't know why that was in there...)
After I removed the port and just kept the IP it worked fine with https.

@ebaauw
Copy link
Owner

ebaauw commented Nov 21, 2024

Thanks for the info! The port in hosts was needed for deCONZ, which can be configured to use a non-default port. Since we dropped deCONZ support, I’d better remove support for specifying the port in Homebridge Hue.

So, apparently, the wrong version number in the error message refers to the SSL version of the Hue bridge (which would be bogus on the plain HTTP port 80), rather than the version of the SSL library on the NodeJS host?

@ruudbol
Copy link
Author

ruudbol commented Nov 22, 2024

Thx @oleschaper, that solved my issue, i removed port 80, everything is working fine now, even https.

ebaauw added a commit to ebaauw/hb-hue-tools that referenced this issue Nov 23, 2024
ebaauw added a commit that referenced this issue Nov 25, 2024
Check for valid hostnames and ignore port, see #1196.
ebaauw added a commit to ebaauw/hb-hue-tools that referenced this issue Nov 25, 2024
Change `--host` parameter to `--hostname` and don't accept a port, see ebaauw/homebridge-hue#1196.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants