[MAJOR UPDATE] @sammachin/node-red-matter-bridge

So its over a year since I published my very basic Matter smart home bridge nodes, but I've finally found some time (and the matter.js library has improved enough) to make some big steps forward.

Stablity is much improved and I've added support for pretty much all the device that Matter controllers actually work with. I'll try and get a video out this weekend of me updating my Node-RED smart home to use this.

You can expose all sorts of devices and sensors now to your Matter controller from node-red.

Important to note, this is for creating virtual devices from Node-RED that can then be controlled from Apple, Google, Alexa etc. If you are wanting to control actual Matter devices that you have like lightbulbs or smart plugs I'll be publishing a different package for that soon (hopefully)

11 Likes

Hi, I look forward to the lightbulbs or smart plugs feature when you have the time available :+1:

@sammachin - In the context of using the bridge to control MQTT connected IoT devices using Google/nest smart speakers (voice commands) -
Is it necessary to have a physical matter hub to use your matter bridge, or is the bridge linked to Google in a similar way to node-red-contrib-google-smarthome and uses Google Actions, or something else?

@questuk lights and smart plugs are available in the bridge today, or are you wanting to control real hardware?

@Paul-Reed Matter is a local network protocol so all the comms is between a local hub and your node-red instance. There are no cloud services that I run at all unlike the Alexa & Google integrations.

Although you mentioned nest speakers? Those have a build in matter hub anyway. I’m testing with a nest mini v2 here

Hi @sammachin good to hear from you.

I've been waiting for this - great stuff.

I am seeing some issues with errors in the console and managed to crash Node-RED too (though I cannot recreate it).

I cannot give you anything other than logs and observations at this point (difficult to sort the chaff from the wheat atm - but I can try to provide what you need if you let me know)

Unhandled exception

2024-11-06 16:24:40.990 FATAL  Logger               Unhandled error detected: 31ad7549f0cfb70a.aggregator.cb8d2a026a8f8d3d is already defined; endpoint IDs must be unique within parent
  at Parts.assertIdAvailable (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Parts.js:148:13)
  at Parts.add (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Parts.js:55:12)
  at Endpoint.add (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/endpoint/Endpoint.js:348:16)
6 Nov 16:24:40 - [red] Uncaught Exception:
6 Nov 16:24:40 - [error] Error: 31ad7549f0cfb70a.aggregator.cb8d2a026a8f8d3d is already defined; endpoint IDs must be unique within parent
    at Parts.assertIdAvailable (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Parts.js:148:13)
    at Parts.add (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Parts.js:55:12)
    at Endpoint.add (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/endpoint/Endpoint.js:348:16)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.

Common errors

2024-11-06 17:41:06.376 ERROR  CaseServer           An error occurred during the commissioning Fabric cannot be found from destinationId
  at FabricManager.findFabricFromDestinationId (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/fabric/FabricManager.js:128:11)
  at MatterDevice.findFabricFromDestinationId (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/MatterDevice.js:349:32)
  at CaseServer.handleSigma1 (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/session/case/CaseServer.js:125:29)
  at async CaseServer.onNewExchange (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/session/case/CaseServer.js:46:7)
  at async SecureChannelProtocol.onNewExchange (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/protocol/securechannel/SecureChannelProtocol.js:126:9)
  at async ExchangeManager.onMessage (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/protocol/ExchangeManager.js:221:9)
2024-11-06 17:41:43.440 ERROR  CaseServer           An error occurred during the commissioning Fabric cannot be found from destinationId
  at FabricManager.findFabricFromDestinationId (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/fabric/FabricManager.js:128:11)
  at MatterDevice.findFabricFromDestinationId (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/MatterDevice.js:349:32)
  at CaseServer.handleSigma1 (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/session/case/CaseServer.js:125:29)
  at async CaseServer.onNewExchange (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/session/case/CaseServer.js:46:7)
  at async SecureChannelProtocol.onNewExchange (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/protocol/securechannel/SecureChannelProtocol.js:126:9)
  at async ExchangeManager.onMessage (/home/steve/.node-red/node_modules/@project-chip/matter.js/dist/cjs/protocol/ExchangeManager.js:221:9)

Other

Modifying dimmable light via a msg in Node-RED works and updates on google home, but modifying from google home causes an error (and it reverts to previous value 50%)

matter-dimmer-issue

2024-11-06 17:51:51.185 ERROR  Transaction          Rolling back online#f5beefe@e5c0f81b due to error: (ValidationMandatoryFieldMissingError/128) Missing mandatory field optionsMask
2024-11-06 17:51:54.583 ERROR  Transaction          Rolling back online#f5bef00@e5c0f81b due to error: (ValidationMandatoryFieldMissingError/128) Missing mandatory field optionsMask

@Steve-Mcl not sure about the first two issues but that last one is a bug in Google’s controller. I assume you’re on the Google home preview release?

We’ve spoken to the guys at Google about it and they’re pushing a fix but it needs to work its way through the release train,

1 Like

Yep. I am.

Odd. It used to work with your earlier version (starting to doubt myself)

No worries, however I would say it'd be worth checking your code for the Uncaught Exception to avoid killing Node-RED - perhaps you have not hooked up to an on error event or have missed a .catch on a promise chain or passed node.error into the catch of a promise chain or havent wrapped an await with a try catch?

Google docs say;

How Matter works with Google

Control Matter devices with the Home app

To control a third-party Matter-enabled device with the Google Home app or Google Assistant, you need a Google device that acts as a hub for Matter. These Google devices have received software updates so that they can work as a hub for Matter:

  • Speakers: Google Home, Google Home Mini, Nest Mini, Nest Audio
  • Displays: Nest Hub (1st gen), Nest Hub (2nd gen), Nest Hub Max
  • Wi-Fi routers: Nest Wifi Pro (Wi-Fi 6E)
  • Streaming devices: Google TV Streamer (4K)

...so does that mean we can issue a voice command to a Google Home Mini, and use that to change the state of a local network device, such as a non-matter shelly dimmer?

Yes. You can voice control any matter device including the ones created with this package. It works really well. I'm super grateful to @sammachin for putting this together.

You will just need to map the values to/from the shelly device.

1 Like

Thanks Steve, I was hoping you were going to say that!

I currently use node-red-contrib-google-smarthome which is well supported, but complex to set up via Google actions, especially when they keep changing things, and matter being a local network system sounds more appealing.

To show this in action.

(Note : I am a heavy Apple HomeKIT user)

Thanks to @sammachin for this work.

What you see is my iPhone (built in OSX Screen Mirroring) with the HomeApp open, showing a light switch created with this Node.

All I would do from here - is wire these events to the physical world.
and control that end point with HomeApp / Siri / Apple Watch etc etc

And the same will be done in Google/Lexa Land

(showing my default room - I have 5 configured)
ezgif-2-105c7d52c0

3 Likes

Odd. It used to work with your earlier version (starting to doubt myself)
matter.js has always been strict about the commands sent, but the google bug was only introduced in the recent preview release of their controller, so if you used the old version a few months ago it likely would have worked.

No worries, however I would say it'd be worth checking your code for the Uncaught Exception to avoid killing Node-RED - perhaps you have not hooked up to an on error event or have missed a .catch on a promise chain or passed node.error into the catch of a promise chain or havent wrapped an await with a try catch?|

yeah there's some stuff to do to catch errors, unfortunatly matter.js is quite strict about having valid config and if it doesn't like something it throws errors, once you've got the nodes configured correctly its stable but its also possible right now to create invalid configs, I'm still finding the right balance of user flexibilty and not letting people break it!

on the first error endpoint IDs must be unique within parent did you do a deploy only of changed nodes vs full deploy? the main 'server' is the bridge config node so if you modify a node that uses that but didn't restart the config node I think that could cause the error you saw.

What stage were you at with the other commisioning error? was this trying to pair node-red to the matter app with the QR code?

Interesting you should focus on that (and sorry should have mentioned it)
using the QR - it sat trying to connect (at least on HomeKit) - but typing in the code manually - no prob

Thats very strange, the manual pairing code just contains a subset of the info in the QR code, and they both kick off the same commisioning flow

The level control issue with google has been fixed in 0.10.1 with a patch, there's a long backstory to this that I'll have to tell you sometime over a beer!

2 Likes

I see Google has ditched the Actions Console in favour of a 'Developer Console....

Another good reason to consider switching to matter to voice control devices - Google Home Developer Console · Issue #597 · mikejac/node-red-contrib-google-smarthome · GitHub

Has anyone managed to get this working in an Alexa only environment?

Yes should work absolutely fine I use with Alexa at home