To help me progress with my .Net Matter controller, I’m going to try and use the matter.js library to act as a device. I’m hoping this will provide more logging than the ESP32 device and help me get my PASE session working!

Matter.js is a pure Javascript implementation of the Matter protocol. It can act as a controller or as a device. It’s maintained by the same people as the Matter core code, so it should always be up-to-date.

I don’t know if this will help with my troubleshooting, but it’s worth a shot.

Setup

There are a few pre-requisites needed to get started. I’m using a Raspberry Pi running Raspbian.

sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev libusb-1.0-0-dev

The default bluetooth service needs to be stopped and disabled.

sudo systemctl stop bluetooth
sudo systemctl disable bluetooth

The Bluetooth HCI is then started

sudo hciconfig hci0 up

As I plan on running my code as my normal user, this command is needed to the matter.js code can start and stop the bluetooth stack.

sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)

Creating a device

To create a device, I opted for the device-onoff-advanced example as this uses Bluetooth.

Create a new directory and open it. Then run this command.

npm init @matter device-onoff-advanced

Once it’s all installed, start it!

npm run app

It will display a nice QR code

The discriminator and passcode as the started example values, which is nice.

I kicked off my .Net commissioner and I could see some Bluetooth stuff.

Very positive.

During the startup, it dumps the Endpoint and Cluster information, so it’s evident that Endpoint 1 is an OnOffLight.

I hope this code will now reveal some details about my why my PASE sessions don’t work!

Be sure to check out my YouTube channel.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.