#Python Matter Server attempts to commission a node that already belongs to the fabric.

1 messages · Page 1 of 1 (latest)

fathom notch
#

Hi everyone,

Due to the nature of Matter and the use of QRCodes, etc, I was attempting to add a bulb to HA, which was already added.

When going to the Python Matter Server I would see multiple errors, etc.

I later realized that I was trying to add a node which was already being managed by HA.

#

I would like to raise an issue in GitHub, but would like to collect more evidence of this happening.

#

Is there a Debug logs mode that I can enable?
(Using docker python-matter-server:stable)

#

Also, how can I counter check the log information and Node IDs already being managed?

#

in the web UI, I can see the endpoints with several properties, but these seem to be Matter spec being published by the node.

#

Here is some examples of a light bulb already managed, attempted to be commissioned a second time and failing (which makes sense, but it should be a more friendly message):

#
2024-08-21 13:19:14.392 (MainThread) INFO [matter_server.server.device_controller] Starting Matter commissioning with code using Node ID 12.
2024-08-21 13:19:18.337 (Dummy-2) CHIP_ERROR [chip.native.EM] Failed to Send CHIP MessageCounter:217058261 on exchange 2114i with Node: <0000000000000000, 0> sendCount: 4 max retries: 4
2024-08-21 13:19:19.296 (Dummy-2) CHIP_ERROR [chip.native.DMG] Subscription Liveness timeout with SubscriptionID = 0x8780d3bc, Peer = 01:0000000000000006
2024-08-21 13:19:20.725 (Dummy-2) CHIP_ERROR [chip.native.SC] PASESession timed out while waiting for a response from the peer. Expected message type was 33
2024-08-21 13:19:22.755 (Dummy-2) INFO [chip.ChipDeviceCtrl] Established secure session with Device
2024-08-21 13:19:25.456 (Dummy-2) CHIP_ERROR [chip.native.CTL] Error on commissioning step 'SendNOC': 'src/controller/CHIPDeviceController.cpp:1502: CHIP Error 0x0000007E: Trying to add a NOC for a fabric that already exists'
2024-08-21 13:19:25.468 (Dummy-2) CHIP_ERROR [chip.native.EM] Failed to send Solitary ack for MessageCounter:61789621 on exchange 2127i with Node: <0000000000000000, 0>:src/messaging/ExchangeContext.cpp:99: CHIP Error 0x00000002: Connection aborted
2024-08-21 13:19:25.469 (Dummy-2) WARNING [chip.ChipDeviceCtrl] Failed to commission: src/controller/CHIPDeviceController.cpp:1502: CHIP Error 0x0000007E: Trying to add a NOC for a fabric that already exists
2024-08-21 13:19:25.470 (MainThread) ERROR [matter_server.server.client_handler] [139668975205328] Error while handling: commission_with_code: Commission with code failed for node 12.

#

The logs essentially do contain a WARNING at 13:19:25 confirming this, even though it technically tried to do it anyway before simply checking in the first place.

#

But in the phone, doing the normal Google based commissioning, it just says that Something went wrong.

#

Python Matter Server attempts to commission a node that already belongs to the fabric.

earnest fox
#

Problem is that there is no way to know if the node already has been commisisoned (due to security measurements) other than it failing

#

You really need to remember; you can only use the QR code once.

#

In this case we could potentially discover it because our fabric already exists (Trying to add a NOC for a fabric that already exists error) but that is a not so common mistake. The most common mistake is a device that is already added to a fabric

fathom notch
# earnest fox You really need to remember; you can only use the QR code once.

I understand that, but after the bulbs are installed, there is no easy to way to remember which QR code belongs to what unless you take note, specially GU10 which are flush mounted.
Isn't there a way to even when the Matter Server realizes that the node already belongs to is own fabric to give a better message to the end user in the phone?

#

Right now it will just show "retry" and induces the user in keep trying and assuming something is wrong

earnest fox
#

One theory is to keep track of all scanned qr codes. That is what Google is doing for example.
Problem is that in most cases we dont even know the qr code because the first part is done by the OS (as you already know now)

#

so yes we could do this for direct commission nodes but considered that would be only a handful users atm, it doenst have any priority considered we are so underpowered

fathom notch
#

I feel that it's an easy mistake to make if you get a lot of matter devices at once

earnest fox
fathom notch
#

The Google part went well and is at the step where you tell it to give admin to HA

earnest fox
#

multi admin is super powerful feature but also super complex to understand

fathom notch
#

Hence, me wondering, to what extent wouldn't be possible to have HA App either just report as "yes, it was successfull" and than show a message when you switch to it saying "the node {device Name} was already being managed"

earnest fox
#

unfortunately we can almost never detect that

#

we just know "it failed" but not because it was already commissioned. We do plan to add some more info to the dialog such as "is the device already paired?" and such

#

We already help a bit by asking if the device is already paired as first step

#

it is exactly because of this reason

fathom notch
# earnest fox unfortunately we can almost never detect that

technically you can, the logs show this, don't they?
2024-08-21 13:19:25.456 (Dummy-2) CHIP_ERROR [chip.native.CTL] Error on commissioning step 'SendNOC': 'src/controller/CHIPDeviceController.cpp:1502: CHIP Error 0x0000007E: Trying to add a NOC for a fabric that already exists'

#

Or this means something else?

earnest fox
#

Yes, but like I said, that is an exception. In most cases you wont even get this far and the pase session simply fails

#

So yeah, I agree we should try to handle this case but for now other things to do - I hope this will eventually get a more generic solution

fathom notch
#

Strange, in my scenario it always gets this far.

earnest fox
#

What device was it ? wifi ?

fathom notch
fathom notch
#

Not using thread.

earnest fox
#

Strictly taken this is also a device issue because apparantly this device still has its commissioning window open

#

Once a device is commissioned it should close that

#

The "Trying to add a NOC for a fabric that already exists" should normally only appear for an on-network commissioning to an existing fabric

#

So this is starnge for multiple reasons 🙂

fathom notch
#

More a less

#

what I've noticed and maybe its a WiZ specific implementation

#

but...

earnest fox
#

ah... wiz... yeah they behave a bit strange

fathom notch
#

I can put the bulbs into pairing mode (by On/Off 3 times in a row) and they don't loose the commisioning of the previous Fabrics or Wiz app

earnest fox
#

they added matter on top of their existing implementation

fathom notch
#

Hence, even while being already commissioned, they will still go into pairing mode and aallow the entire process again

earnest fox
fathom notch
#

I've ordered a Matter bulb from another brand to compare

earnest fox
#

Imo this is a device bug

#

the device should reset the creds if you put it in commisisoning mode again

#

but maybe they are unique and allow the qr code to multiple fabrics (which would be a violation of spec)

#

I have a wiz light here somewhere, worth a test

#

With any other matter device I have tested so far, you can only commission just once using the QR. Then the device closes the commisisoning over bluetooth

fathom notch
#

I haven't received it yet, should have arrived today, but Amazon failed delivery, so tomorrow

#

its a Nous P8

#

its a cheap bulb that I got literally just to compare behaviors lol

fathom notch
#

well, surprise surprise, the courier just delivered the Nous P8 lol

#

It starts well, it's failing at the "Checking connectivity" step lol, saying it can't connect to my wifi 😄

#

Ok I know why, I need to change my setup, I have 2 SSIDs with the same name, just different PW (due to a compatibility issue I had in the past with Shelly), need to marge everything into one

#

Well, so far it paired fine after retrying a couple times to pass the connectivity part

#

The white quality is noticeable, WiZ are better lol

#

The P8 doesn't do fades turning on or off, is always instant, but at least tge power recovery config works

#

@earnest fox I have bad news 🤣

#

I'm able to reproduce the issue with the Nous P8, but in a different way

#

It allows to be put in pairing more also with the On/off 3 times

#

Goes thru the process of commissioning, etc

#

When it gets to the step where it's added to HA, it's accepted and works, but kinda...

#

The same device that was already there stays, but a new light entity is created

#

The old light becomes unavailable

#

I will PM you a screenshot

#

What a mess lol

#

I haven't look at the Matter Server logs yet, will do in a second

earnest fox
#

It just overwrote the existing entry then, that is crappy

#

So this is not fixable - we have no way to tell upfront to tell if the device was already commissioned

#

for you, you now can remove the orphan device from the Matter server UI

#

HA linked the both together into one device due to the same serial

fathom notch
#

I have a feeling that was mostly within HA

#

in Matter Server, the first pairing shows as Node 14 (currently Offline) and the second attempt where I reproduce the issue, shows as Node 15.

#

In HA is where it overwrote the device, but for some reason, the light entity decided to add a "_2" one

earnest fox
#

yes, exactly

earnest fox
fathom notch
#

I've sent you a screenshot of the new light entity

earnest fox
#

It are now just 2 matter devices

#

the first one kicked out

fathom notch
#

something that it can't do with WiZ, because is not exposing the serial

#

still, it's weird that if HA goes and matches the device by Serial, but than decides to mess up with the light entities

#

and leave an orphaned entity

earnest fox
#

yes because it merged two matter devices

#

the orphaned one and the new one

#

so this is expected

fathom notch
#

right, but I since it matched the device by serial, I would expect it to just override the entities

earnest fox
#

nope, that is not how that works

#

HA != Matter server

fathom notch
#

it's contradictory in a sence the current behavior

earnest fox
#

btw now you can just delete node 14 from the matter server

fathom notch
#

also, curious to compare the endpoints

earnest fox
#

they will be exact the same, its the same device

#

the device itself just threw away the entry for our fabric when it detected the same

fathom notch
#

Just leaving it here in case someone runs into this thread in the future:
I do not recommend Nous P8 lamps at all looool
They are not color accurate at all, like by a lot.

earnest fox
#

Yeah, I tested one of those cheap bulbs here as well and have the same experience

fathom notch
earnest fox
#

Hue for Zigbee and Nanoleaf for Matter over Thread

fathom notch
#

I've heard people complaining about Nanoleaf where it frequently becomes unavailable, etc, have you ran into issues like that?

earnest fox
earnest fox
# fathom notch I've heard people complaining about Nanoleaf where it frequently becomes unavail...

Yes, Nanoleaf were probably the most unreliable piece lights of the universe when they launched them and they learned that the hard way. This discord server exploded and I was totally overloaded with support requests as they were not only unreliable themselves, they also took down entire thread networks. But... they have been fixing their stuff for weeks/months and we also worked actively with them and now they are pretty damn good. especially when you compare them to Hue. They have the same good colors and build quality but for a fraction of the price. Still, I have both in my home, the Hue ones never fail me. The Nnaoleaf lights do but I account that more to Thread being unreliable still sometimes.

fathom notch
#

which I didn't expect to happen, since the other node was still linked to it

#

Now I still see Node 15 on Python Matter Server web UI, but not in HA

#

so will need to re-add it

earnest fox
#

HA got confused due to the linked devices

#

Which is btw an interesting issue on its own 🙂

fathom notch