My device is a Matter switch with 12 buttons, but its physical buttons do not correspond to the button icons displayed in the Apple Home App. The mapping between them is chaotic, for example, physical button 1 is mapped to button icon 3, and physical button 2 is mapped to button icon 7, without any pattern. And every time the factory settings are restored and the network is reconfigured, the mapping will be different from the last time, and restoring the factory settings will change it again. I have checked my program and I am certain that the events triggered by physical buttons correspond correctly to the Matter Generic Switch Endpoint in the ZCL file. I don't understand why there was such a mistake. I am using GSDK 4.4.1, Silicon Labs Matter 2.2.1-1.2. I asked the manufacturer of the chip (the staff of Silicon Labs), and they said that the corresponding order displayed on the app is determined by the APP side, and has nothing to do with Matter devices, is this a problem caused by Apple's system, and if so, is there any solution?
There is a mapping issue between the physical buttons of the Matter switch and the buttons on the Apple Home App.
Let me start with the issue here:
The mapping between them is chaotic, for example, physical button 1 is mapped to button icon 3, and physical button 2 is mapped to button icon 7, without any pattern.
At the "base" level, HomeKit doesn't actually enforce any specific ordering of services/characteristics. What basically happens is that it initially receives the object in a unordered state and then (basically) applies it's own sort order based on metadata of the objects. This dynamic isn't really visible in HAP accessories because the HAP specification requires sufficient definition of every object that the sort order will be predictable.
However, the Matter specification isn't as strict, which ends up causing the behavior you're seeing. Note what's actually going on here:
device button 1-> Home.app 3
...
device button 2-> Home.app 7
..was actually that Home.app received the object in a specific order and then add an artificial label (3 & 7) because it didn't have any metadata from the object itself which it could use instead.
Similarly:
And every time the factory settings are restored and the network is reconfigured, the mapping will be different from the last time, and restoring the factory settings will change it again.
In the absence of the metadata that would otherwise order the data, the order ends up being determined by internal object data that's set during pairing. That ends up causing the "reorder".
I asked the manufacturer of the chip (the staff of Silicon Labs), and they said that the corresponding order displayed on the app is determined by the APP side, and has nothing to do with Matter devices, is this a problem caused by Apple's system,
Sort of. There's nothing "wrong" with the device as far as the matter spec is concerned, however, the device does not have sufficient metadata to work with HomeKit.
and if so, is there any solution?
Yes. I'm not sure of exactly what's required in your configuration, but the basic answer is that you need to expand the accessory metadata you're exporting to HomeKit until you get the result you want.
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware