Using activeOperationalDataSet with Matter chip-tool

I am trying to commission an ESP32-H2 Matter device using the chip-tool. It's running the Light Switch sample. I can commissioning it using the iOS Home App, so I know the code on it's working okay.

I would like to understand more about the Fabric process, so I'd like to use the Home Pod powered Thread network rather than setting up an instance of Open Thread Border Router.

I have created a simple iOS app and can fetch the activeOperationalDataSet from the Preferred network using

 func obtainPreferredNetworkCredentials() async -> (Void) {

    let client = THClient()
    let bIsPreferredAvailable = await client.isPreferredAvailable()

    if bIsPreferredAvailable == true
    {
        var credential: THCredentials?

        do {
              credential = try await client.preferredCredentials()

              if let dataset = credential?.activeOperationalDataSet {
                  print(dataset.hexDescription)
              }
         } catch {
             print("Failed to get the credentials")
         }
     }
}

The hexDescription comes from this extension

extension Data {
    var hexDescription: String {
        return reduce("") {$0 + String(format: "%02x", $1)}
    }
}

I am decoding the Data and displaying it as a hex string. It looks something like this:

0e080000000000000000000300001935060004001fffc002089f651677026f48070708fd9f65167702000<trunacated>ee90914b5d1097de9bb0818dc94690c0402a0f7f8

However, when I attempt to commission the device, it fails during ThreadSetup. Googling the issue says most likely the Operational Dataset is wrong in some way.

Before I spend too much time on this, I want to make sure I'm doing the right thing in terms of getting the Operational Dataset to use with the chip-tool.

Any help is appreciated!

Answered by tomasmcguinness in 827879022

I found the solution! The operational dataset was fine, but I made a mistake with the chip-tool.

When using the dataset as one of the parameters, it must be prefixed with "hex:". I was missing that.

I was successfully able to add my ESP32-H2 into the Home Pod Thread network.

Accepted Answer

I found the solution! The operational dataset was fine, but I made a mistake with the chip-tool.

When using the dataset as one of the parameters, it must be prefixed with "hex:". I was missing that.

I was successfully able to add my ESP32-H2 into the Home Pod Thread network.

Using activeOperationalDataSet with Matter chip-tool
 
 
Q