Matter: Commissioning of a device

Hi everyone,

I am pretty new to writing Swift and only doing it to extend a React Native App, thus my knowledge is a bit limited.

I am trying to follow the example from https://developer.apple.com/documentation/mattersupport/adding-matter-support-to-your-ecosystem#Set-the-principal-class

Without implementing the Extension, the Workflow starts but fails after a few minutes to add the device to Apple Home. Hence, I am currently trying to add the extension (as this is later on needed anyway to commission the device to our ecosystem).

I added the class with some dummy logs to see if anything gets triggered but I am failing at registering the class as stated at https://developer.apple.com/documentation/mattersupport/adding-matter-support-to-your-ecosystem#Set-the-principal-class

How is this meant to work? I guess I need to define it in info.plist but at least this did not work out:

...
<key>NSExtensionPointIdentifier</key><string>com.apple.matter.support.extension.device-setup</string>
<key>NSExtensionPrincipalClass</key><string>IoBrokerAddDeviceExtensionRequestHandler</string>
...

Does anyone know how to register the class?

Thanks in advance.

Kind regards

Moritz

Answered by DTS Engineer in 800090022

I am pretty new to writing Swift and only doing it to extend a React Native App, thus my knowledge is a bit limited. I am trying to follow the example from

https://developer.apple.com/documentation/mattersupport/adding-matter-support-to-your-ecosystem#Set-the-principal-class

Without implementing the Extension, the Workflow starts but fails after a few minutes to add the device to Apple Home.

First off, a few quick clarifications here:

  1. The matter support architecture is NOT required to pair a Matter accessory into HomeKit. Matter accessories can be directly paired into HomeKit using "HMAccessorySetupManager". Individual accessories can be paired by providing the target payload, or you can let HomeKit handle everything by scanning the code through the camera. However, the key point is that you should not try and sort out the Matter Support framework until your accessory is directly pairing through HomeKit. I've seen many developers waste a lot of time fighting with Matter Support when the real problem was that the accessory wasn't really working properly.

  2. You do not need an ecosystem implementation to use matter to communicate with your accessory. This forum post describes the process in more detail, but the summary is that the HomeKit framework exports specific information which you can then pass into the Matter framework, which will then allow communication.

https://developer.apple.com/documentation/mattersupport/adding-matter-support-to-your-ecosystem#Set-the-principal-class

FYI, that document says to set "NSPrincipalClass" but the correct key is the one you're using, "NSExtensionPrincipalClass" (r.133849742).

How is this meant to work? I guess I need to define it in info.plist but at least this did not work out:

<key>NSExtensionPointIdentifier</key><string>com.apple.matter.support.extension.device-setup</string>

<key>NSExtensionPrincipalClass</key><string>IoBrokerAddDeviceExtensionRequestHandler</string> ...

Does anyone know how to register the class?

That document was added before we'd added the "Matter Extension" Xcode template. If you look at the template configuration, the template uses this definition:

$(PRODUCT_MODULE_NAME).<class name>

In other words, you need to use the "full" class name (including module prefix), not the just the class name.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

I am pretty new to writing Swift and only doing it to extend a React Native App, thus my knowledge is a bit limited. I am trying to follow the example from

https://developer.apple.com/documentation/mattersupport/adding-matter-support-to-your-ecosystem#Set-the-principal-class

Without implementing the Extension, the Workflow starts but fails after a few minutes to add the device to Apple Home.

First off, a few quick clarifications here:

  1. The matter support architecture is NOT required to pair a Matter accessory into HomeKit. Matter accessories can be directly paired into HomeKit using "HMAccessorySetupManager". Individual accessories can be paired by providing the target payload, or you can let HomeKit handle everything by scanning the code through the camera. However, the key point is that you should not try and sort out the Matter Support framework until your accessory is directly pairing through HomeKit. I've seen many developers waste a lot of time fighting with Matter Support when the real problem was that the accessory wasn't really working properly.

  2. You do not need an ecosystem implementation to use matter to communicate with your accessory. This forum post describes the process in more detail, but the summary is that the HomeKit framework exports specific information which you can then pass into the Matter framework, which will then allow communication.

https://developer.apple.com/documentation/mattersupport/adding-matter-support-to-your-ecosystem#Set-the-principal-class

FYI, that document says to set "NSPrincipalClass" but the correct key is the one you're using, "NSExtensionPrincipalClass" (r.133849742).

How is this meant to work? I guess I need to define it in info.plist but at least this did not work out:

<key>NSExtensionPointIdentifier</key><string>com.apple.matter.support.extension.device-setup</string>

<key>NSExtensionPrincipalClass</key><string>IoBrokerAddDeviceExtensionRequestHandler</string> ...

Does anyone know how to register the class?

That document was added before we'd added the "Matter Extension" Xcode template. If you look at the template configuration, the template uses this definition:

$(PRODUCT_MODULE_NAME).<class name>

In other words, you need to use the "full" class name (including module prefix), not the just the class name.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Matter: Commissioning of a device
 
 
Q