Open pdrtrifork opened 11 months ago
Yes, the MTRBaseCluster classes do not work with XPC-remoted MTRBaseDevice instances. They do work with non-remoted MTRBaseDevice.
They should probably just fail init when initializing with a remoted MTRBaseDevice.... @kpark-apple unless you have plans to make that part work?
Thank you for the swift reply. We will just use [MTRBaseDevice readAttributesWithEndpointID:clusterID:attributeID:params:queue:completion:]
for the time being.
Thank you for reporting this. We are also working on an app that accesses Matter via HomeKit/XPC, and I am very surprised about the limitations. I expected unrestricted access to everything the Matter framework provides and am very surprised to find issues like this.
The XPC bits are extremely limited so far. They don't even support all function on MTRBaseDevice. In my opinion we should not have released them at all in their current state, but ...
Note, this API is likely to be deprecated soon, and we will encourage folks to use MTRDevice (with similar functionality).
Greetings @bzbarsky-apple @woody-apple @kpark-apple! Is there a way to open the commissioning window for XPC-remoted MTRBaseDevice / MRTDevice instances? Currently, I'm encountering an "MTRBaseDevice / MRTDevice doesn't support openCommissioningWindowWithDiscriminator over XPC" error. My goal is to add all Matter accessories from the Apple Home to our fabric. Could you possibly suggest an alternative approach to accomplish this? Unfortunately, I'm unable to find relevant documentation for this case.
Is there a way to open the commissioning window for XPC-remoted MTRBaseDevice / MRTDevice instances?
Not via the convenience APIs. You'd have to explicitly send OpenCommissioningWindow commands.
Reproduction steps
We are currently working on an iPhone app that is supposed to communicate with specific Matter devices using the HomeKit and Matter frameworks.
I am able to access device attributes using
[MTRBaseDevice readAttributesWithEndpointID:clusterID:attributeID:params:queue:completion:]
, but not using e.g.[MTRBaseClusterBasicInformation readAttributeLocationWithCompletion:]
(location is just an example).HMHome
instance fromHMHomeManager
matterNodeID
MTRDeviceController
usingMTRDeviceController.sharedController(withID:,xpcConnect:)
MTRBaseDevice
usingMTRBaseDevice(nodeID:,controller:)
MTRBaseClusterBasicInformation
usingMTRBaseClusterBasicInformation(device:,endpointID: 0, queue: DispatchQueue.main)
baseCluster.readAttributeLocation(completion:)
Below are the important pieces of code:
Platform
darwin
Platform Version(s)
iOS 16.6, Xcode 14.3.1 (14E300c)
Type
Manually tested with SDK
(Optional) If manually tested please explain why this is only manually tested
We created an iPhone app with the minimal amount of code to access Apple Home, and get an device controller and device using HomeKit and Matter SDK's.
Anything else?
No response