ebaauw / homebridge-hue

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

Recalling a scene from the Hue app throws error #1142

Closed CooperCGN closed 1 year ago

CooperCGN commented 1 year ago

Issue

as the title says recalling a scene from the hue app is causing homebridge-hue to throw the error mentioned below. The string "o5SLy7svRu6H3YF" seems to be the scene name as I am using those in some HomeKit automatons to recall those scenes. Other than that the plugin is working as expected.

Log Messages

[30/01/2023, 06:41:09] [Hue] Philips hue: event stream error: TypeError: Cannot read properties of undefined (reading 'o5SLy7svRu6H3YF')
    at EventStreamClient.<anonymous> (/var/lib/homebridge/node_modules/homebridge-hue/lib/HueBridge.js:1052:29)
    at EventStreamClient.emit (node:events:513:28)
    at EventStreamClient.parseUpdate (/var/lib/homebridge/node_modules/homebridge-hue/lib/EventStreamClient.js:280:16)
    at EventStreamClient.parseContainer (/var/lib/homebridge/node_modules/homebridge-hue/lib/EventStreamClient.js:198:16)
    at IncomingMessage.<anonymous> (/var/lib/homebridge/node_modules/homebridge-hue/lib/EventStreamClient.js:162:26)
    at IncomingMessage.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at IncomingMessage.Readable.push (node:internal/streams/readable:234:10)
    at HTTPParser.parserOnBody (node:_http_common:129:24)

Debug Files

homebridge-hue.json.gz

ebaauw commented 1 year ago

Looks like Homebridge Hue chokes on something the Hue bridge publishes on the event stream on scene recall. I don't think I've seen scene recall events before.

Could you please run ph -DDD -H x.x.x.x eventlog and capture the raw data when recalling the scene?

CooperCGN commented 1 year ago

When I log into my Pi and try to run the command I get "-bash: ph: command not found". Where is it located? Maybe I need to run it directly from the directory. (I am using the official Homebridge image).

ebaauw commented 1 year ago

It should be installed with Homebridge Hue, to /usr/bin or /usr/local/bin, depending on your system and installation method. Try npx ph ..., or locate it as ph.js in the cli directory of Homebridge Hue, .../node_modules/homebridge-hue/cli/ph.js.

I see your bridge has a later firmware version than mine. I guess they added new events in that version.

CooperCGN commented 1 year ago

Hope I did everything right and this helps

eventlog.txt

ebaauw commented 1 year ago

Thanks, I think I can work with that. Definitely some new feature by the Hue bridge.

CooperCGN commented 1 year ago

Great, if you need any more info please let me know.

ebaauw commented 1 year ago

My bridge auto-upgraded Thursday and I can now reproduce the issue. Looks like the Hue bridge now (finally) keeps track whether a scene is (still) active. EventStreamClient now handles scenes events correctly (and through this, ph eventlog. Homebridge Hue now logs, but otherwise ignores these.

CooperCGN commented 1 year ago

Great to hear, waiting for the update then to test this.

ebaauw commented 1 year ago

In v0.13.52.

CooperCGN commented 1 year ago

Works as expected, guess this can be closed then.