How do I get the device ID from the callback information when a HomeKit paired with a Matter device within an application

I'm trying to pair the Matter by calling HomeKit from within our app, I can successfully pair and the matter device is discovered via bonjour, but after the HomeKit pairing success callback, I can't get a similar UUID or other identifier.

I invoked HomeKit with the following code


- (void)addAccessoriesWithCompletion:(void (^)(NSError * _Nullable))completion {

    if(@available(iOS 15.4, *)) {

        HMAccessorySetupRequest *setupRequest = [[HMAccessorySetupRequest alloc] init];

        setupRequest.homeUniqueIdentifier = self.currentHome.uniqueIdentifier;

        [self.setupManager performAccessorySetupUsingRequest:setupRequest completionHandler:^(HMAccessorySetupResult * _Nullable result, NSError * _Nullable error) {

                   completion(error);

        }];

    }

    else {

        [self.currentHome addAndSetupAccessoriesWithCompletionHandler:completion];

    }

}



- (HMAccessorySetupManager *)setupManager {

    if (_setupManager == nil) {

        _setupManager = [[HMAccessorySetupManager alloc] init];

    }

    return _setupManager;

}



HomeKit successfully added device delegate


- (void)home:(HMHome *)home didAddAccessory:(HMAccessory *)accessory {

    if (self.homeDidAddAccessoryBlock) {

        self.homeDidAddAccessoryBlock(accessory);

    }

    accessory.delegate = self;

}

Multiple matter devices may be discovered through bonjour, and I need to know which matter device I just added in order to bind to our user system.

So I need to get the device id from the HomeKit pairing success callback so I can filter the matter device.

Or do we need to set something on our matter firmware?

Accepted Reply

After iOS16.1, this issue was resolved with the addition of a matterNodeID in HMAccessory to tag the device, the same ID you can find in bonjour's name field, provided you resolve to decimal correctly

Replies

After iOS16.1, this issue was resolved with the addition of a matterNodeID in HMAccessory to tag the device, the same ID you can find in bonjour's name field, provided you resolve to decimal correctly

Hi i am trying to read Homekit matter accessory cluster informaiton and wants to communicate with accessory using my application, coulld you please help me with sample application how i can achive.

  • You cannot directly read the cluster information of HomeKit Matter accessories. You need to become a commissioner or MTRDeviceController first, and hold the device Matter. If you want to implement Commission yourself, it is recommended to use both MatterSupport and Matter.framework

Add a Comment

if add device with matterSupport where I get the matterNodeID?