ebaauw / homebridge-hue

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

v0.14.3 not working getting the following messages #1196

Open ruudbol opened 1 week ago

ruudbol commented 1 week ago

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 commented 1 week ago

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 commented 1 week ago

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 commented 1 week ago

Yes, hue dimmer switch and hue tap dial switchOp 9 nov 2024 om 20:11 heeft Erik Baauw @.***> het volgende geschreven: 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.

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

ruudbol commented 1 week ago

IMG_0554

ebaauw commented 1 week ago

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 commented 1 week ago

I pressed the hue bridge button within 5 seconds of the question asked. An api is created, and that key I need to put in the config.json? Because, as in 0.14.2, 0.14.3 doesn’t do this automaticaly. Am i right?Met vriendelijke groet,Herbert BlomOp 10 nov 2024 om 16:55 heeft Erik Baauw @.***> het volgende geschreven: 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.

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

ebaauw commented 1 week ago

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 commented 1 week ago

Hi Erik, I still get the following message

[11/11/2024, 08:08:37] [Hue] Hue Bridge: Signify Netherlands B.V. BSB002 bridge v1967054020, api v1.67.0 [11/11/2024, 08:08:37] [Hue] Hue Bridge: request 3: http status 404 Not Found [11/11/2024, 08:08:37] [Hue] Hue Bridge: http status 404 Not Found - retrying in 15s

I executed ph -H …. getApiKey XBZ2bTWlM39CH9NzsDah-fSF6g6Dw1MqsnjQg099

And in config.json I put the ApiKey in users part

        "users": {
            "ECB5FAFFFE2E0CD1": "XBZ2bTWlM39CH9NzsDah-fSF6g6Dw1MqsnjQg099"
        },

This is the complete json.config for HUE

"name": "Hue", "anyOn": true, "excludeSensorTypes": [ "Daylight" ], "forceHttp": true, "hosts": [ "192.168.1.100:80" ], "lights": true, "effects": true, "nativeHomeKitLights": false, "nativeHomeKitSensors": false, "resource": true, "sensors": true, "users": { "ECB5FAFFFE2E0CD1": "XBZ2bTWlM39CH9NzsDah-fSF6g6Dw1MqsnjQg099" }, "_bridge": { "username": "0E:73:66:35:B4:8E", "port": 51840 }, "platform": “Hue"

Hope you can help, for now i will downgrade to 0.14.2

Kind Regards, Ruud

Op 10 nov 2024, om 23:19 heeft Erik Baauw @.***> het volgende geschreven:

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

— Reply to this email directly, view it on GitHub https://github.com/ebaauw/homebridge-hue/issues/1196#issuecomment-2466958613, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOTFY6VR5XIQYW7A6GSQKLDZ77LX3AVCNFSM6AAAAABRPBCN7OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRWHE2TQNRRGM. You are receiving this because you authored the thread.

ebaauw commented 1 week ago

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 commented 1 week ago

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.

ruudbol commented 1 week ago

Hi Erik, installeer 0.14.4 and switch off force http, however I then get the following message

[11/11/2024, 10:36:07] Loaded 0 cached accessories from cachedAccessories.0E736635B48E. [11/11/2024, 10:36:07] [Hue] homebridge-hue v0.14.4, node v22.11.0, homebridge v1.8.5 [11/11/2024, 10:36:07] [Hue] Hue Bridge: Signify Netherlands B.V. BSB002 bridge v1967054020, api v1.67.0 [11/11/2024, 10:36:07] [Hue] Hue Bridge: request 1: GET / [11/11/2024, 10:36:07] [Hue] Hue Bridge: request 1: write EPROTO C0EAFE76:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:

[11/11/2024, 10:36:07] [Hue] Hue Bridge: write EPROTO C0EAFE76:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:

Kind regards, Ruud

Op 11 nov 2024, om 10:07 heeft Erik Baauw @.***> het volgende geschreven:

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.

— Reply to this email directly, view it on GitHub https://github.com/ebaauw/homebridge-hue/issues/1196#issuecomment-2467604568, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOTFY6WIZTAK4SEN36M6M6L2ABXWPAVCNFSM6AAAAABRPBCN7OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRXGYYDINJWHA. You are receiving this because you authored the thread.

ebaauw commented 1 week ago

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 commented 1 week ago

Did you have a similar message with v0.14.2 without forceHttp — YESAre you running Homebridge Hue in a separate child bridge —YESDid you re-install Homebridge and Homebridge Config UI X after upgrading to NodeJS v22 — NOOp 11 nov 2024 om 11:17 heeft Erik Baauw @.***> het volgende geschreven: 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.

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

ebaauw commented 1 week ago

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 commented 1 week ago

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