FezVrasta / node-red-matter

Create Virtual Devices with Ease for the Matter Protocol!
38 stars 7 forks source link

Exception when loading MatterController #11

Open Nik19792000 opened 6 months ago

Nik19792000 commented 6 months ago

Hi, I played around with node-red-matter, and I was even able to add one Device to Google Home, but shortly afterwards, Node Red failed to restart due to the following error:

1 Jan 12:03:45 - [info] [matter-server:MatterServer] Starting matter server
1 Jan 12:03:45 - [info] [matter-server:MatterServer] Added commissioning controller for 7e8198ecd6d4ee69
1 Jan 12:03:45 - [info] [matter-server:MatterServer] All related nodes added (1/1)
1 Jan 12:03:45 - [info] [matter-server:MatterServer] Starting matter server
1 Jan 12:03:45 - [info] Started modified flows
1 Jan 12:04:00 - [red] Uncaught Exception:
1 Jan 12:04:00 - [error] Error: No device discovered using identifier {"shortDiscriminator":15}! Please check that the relevant device is online.
    at MatterController.<anonymous> (/config/node_modules/@project-chip/matter.js/src/MatterController.ts:181:19)
    at Generator.next (<anonymous>)
    at fulfilled (/config/node_modules/@project-chip/matter.js/dist/cjs/MatterController.js:10:58)
[12:04:00] INFO: Service Node-RED exited with code 1 (by signal 0)

I re-installed node-red-matter and I can narrow it down to just adding a MatterControllerStatusNode and defining a MatterController and MatterServer. As soon as I do this, I get this error. Any idea, what's the problem?

Nik19792000 commented 6 months ago

I guess, I misinterpreted the purpose of the MatterController node. If I only want to create virtual Matter devices in NodeRed, then I shouldn't use MatterController node, right? It's still a bit ideal to have the whole thing crash, if I pick a wrong node. I had to start NodeRed in safe mode to be able to delete the node.

Apollon77 commented 6 months ago

Correct, The MatterController is used to pair with a matter device

Apollon77 commented 6 months ago

Bu tin fact yes the code need to catch the error ideally :-)

FezVrasta commented 6 months ago

Do you have a configuration to share to reproduce the crash?

Nik19792000 commented 6 months ago

You can just add a Matter Controller Status node. Then add a new Matter Controller and use a valid pairing code (e.g. 749701123365521327694). When you deploy the flow, the error will show and node-red will stop.