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?
Post not yet marked as solved
On iOS 16.0, I added accessories via the MTRDeviceController class in the Matter.framework, and it worked fine.
But when I will phone upgrade to the latest version of the iOS (iOS 16.1.1), after I call "MTRDeviceController" class "pairDevice: onboardingPayload: error:" method. I get an error like this:
CHIP: [BLE] BLE:Error writing Characteristics in Chip service on the device: [The specified UUID is not allowed for this operation.]
According to the error message, I guess that the characteristics of a certain Bluetooth cannot be read and written. After trying to verify it, I find that the characteristics uuid of the Matter accessory: "18EE2EF5-263D-4559-959F-4F9C429F9D12" cannot be read.
So, my question is what can I do in iOS 16.1.1 to make my app work as well as it does on iOS 16.0.
Post not yet marked as solved
I am trying to manage my Matter device using MatterSupport.Framework.
Prior to this I was using the matter.Framework, and I added devices through the commissionDevice API, which has the ability to set DeviceId for Matter devices. I was then able to use deviceId to control my device (like setting switches, brightness, etc.).
But due to some other issues, I had to add my device using the MatterAddDeviceRequest API in MatterSupport.
I can't find a unique identifier for a device such as "deviceID" in the documentation. So I'm confused, how do I control my matter device after adding it via the MatterAddDeviceRequest API
Post not yet marked as solved
I'd like to learn how a Matter "Binding" can be created on iOS, e.g. via the "Matter" Framework.
I'm aware of the Matter Framework "Documentation" here.
But since it's missing any real description or documentation it's not helpful to me atm.
Any examples/ tutorials/ explanations are greatly appreciated.
Run the sample code as doc https://developer.apple.com/documentation/mattersupport?changes=latest_minor
import MatterSupport
let request = MatterAddDeviceRequest(
topology: .init(ecosystemName: "Acme SmartHome", homes: [
.init(displayName: "Default Acme Home"),
])
)
do {
try await request.perform()
print("Successfully set up a device!")
} catch {
print("Failed to set up a device with error: \(error)")
}
it runs but stuck in the scene below, never get the callback.
Another issue about MatterSupport, when integrated with objective-c the bridge file(eg xx-Swift.h) turn out to show error:
Cannot find interface declaration for 'MatterAddDeviceExtensionRequestHandler', superclass of 'MatterAddDeviceHandler'
Xcode Version 14.2 (14C18)
My code:
//
// MatterHelper.swift
// xx
//
// Created by Robin on 2023/3/21.
//
import Foundation
import MatterSupport
@available(iOS 16.1, *)
class MatterHelper: NSObject
{
@objc class func commission()
{
let request = MatterAddDeviceRequest(
topology: .init(ecosystemName: "RRRRRR", homes: [
.init(displayName: "R11111"), .init(displayName: "R222222")
])
)
Task.init
{
do
{
try await request.perform()
print("Successfully set up a device!")
}
catch
{
print("Failed to set up a device with error: \(error)")
}
}
}
}
@available(iOS 16.1, *)
class MatterAddDeviceHandler: MatterAddDeviceExtensionRequestHandler
{
override func validateDeviceCredential(_ deviceCredential: MatterAddDeviceExtensionRequestHandler.DeviceCredential) async throws
{
print("validateDeviceCredential \(deviceCredential)")
}
override func selectThreadNetwork(from threadScanResults: [MatterAddDeviceExtensionRequestHandler.ThreadScanResult]) async throws -> MatterAddDeviceExtensionRequestHandler.ThreadNetworkAssociation
{
print("selectThreadNetwork \(threadScanResults)")
return ThreadNetworkAssociation.defaultSystemNetwork
}
override func commissionDevice(in home: MatterAddDeviceRequest.Home?, onboardingPayload: String, commissioningID: UUID) async throws
{
print("Home: \(String(describing: home)) " + "payload: \(onboardingPayload) " + "commissionID: \(commissioningID)")
}
}
Many thanks for your help.
Post not yet marked as solved
Hello,
I trying to commission and joint thread matter device through I-phone ( ios 16.3.1) and apple home pod mini (16.3.2).
After scanning QR code and following setup process it fails to add accessory and iPhone shows" Pairing with device failed" (attaching screen shot).
I confirmed with device manufacturer, and it seems to be problem from apple side.
Any help will be appreciated, Thank you.
Post not yet marked as solved
Added the MatterExtension for MatterAddDeviceExtensionRequestHandler as new Target. Everything is automatically generated.
But still only the default MatterAddDevice pickerView is displayed instead of MatterAddDeviceExtension?!
func play() {
Task {
let homes = [MatterAddDeviceRequest.Home(displayName: "my Home")]
let topology = MatterAddDeviceRequest.Topology(ecosystemName: "MyEcosystemName", homes: homes)
let request = MatterAddDeviceRequest(topology: topology)
do {
try await request.perform()
print("Successfully set up device!")
} catch {
print("Failed to set up device with error: \(error)")
}
}
}
Entitlements:
Matter Allow Setup Payload = YES
.plist is set up:
NSLocalNetworkUsageDescription
NSBonjourServices:
Post not yet marked as solved
”…iOS will return a pairing code to your app, and your app can proceed to set up its administrator fabric on the accessory via IP using the pairing code.”
but where?
Post not yet marked as solved
I can bind the light bulb to the light switch through chip-tool software
But when I added the light bulb to the apple home app, I noticed two problems
(1) The light switch is displayed as an unsupported accessory, note that it is an unsupported accessory, not an uncertified device, because the light bulb can be normally added to the home app and is only displayed as an uncertified device
(2) If the light switch can be added to the home app, then I do not know how to bind the light bulb to the light switch
Post not yet marked as solved
when using these IOS matter source SDK on IOS phone to setup matter device , could we do it without homepod or apple TV? just using IOS matter app.
Post not yet marked as solved
Matter-enabled devices can be commissioned directly using MatterSupport and Default System UI.
But what if we don't want that default system ui instead want to implement an entire customized flow as in Matter Sample iOS app.
How can I do that if I'm using MatterSupport and want a custom flow instead of a default flow?
Currently, in custom flow, the user has to enter ssid and password of the network connection, but I want to programmatically read SSID and password on the network and pass those as arguments to the chip controller for commissioning.
Is it possible in iOS to read the credentials of a wifi network by any chance?
Post not yet marked as solved
I have tried to add Meross matter plug but still pairing failed, it reported always same error.
error: related decl 'e' for HMErrorCode(_nsError: Error Domain=HMErrorDomain Code=18 "Pairing Failed" UserInfo={NSLocalizedDescription=Pairing Failed, NSUnderlyingError=0x281503cc0 {Error Domain=HAPErrorDomain Code=3 "(null)"}})
Post not yet marked as solved
Hello,
I'm trying to add matter devices to home kit. It end up saying as "Unable to add accessory"
Using:
Home Pod Mini
Version:16.6
Model: MJ2E3
IOS version: 16.6
Post not yet marked as solved
To be able to paire a matter device on ios I need to installed on my iPhone the matter client developper profile as indicate on the apple documentation
Adding Matter support to your ecosystem | Apple Developer Documentation
(To test your app on the iOS or macOS device that initiates the pairing, download the developer profile now, then install it.)
When I do that it works perfectly.
Otherwise the documentation says that the profile is only needed for development but when I want to use my app from the apple store (validate by Apple) and when I remove the profile it doesn't work anymore.
What do I have to do to paire Matter device on iphone without the Matter client developer profile.
Post not yet marked as solved
Hi,
we develop devices on Matter. I have two questions:
I have a device with four buttons. These are programmable buttons that can be programmed for a short press and a long press. I have an issue that after pairing the buttons with Apple Home, all the buttons are displayed as button 1. They also appear in different environments each time. How do I need to configure the clusters for Apple Home to correctly recognize the buttons?
How do I display the battery status? I'm using the Power Cluster, but Apple Home doesn't detect it. The battery doesn't show up in the app at all. On Samsung SmartThings, the battery works correctly.
Best regards,
HaWca.
Post not yet marked as solved
Hello fellow developers,
I am in the process of developing an iOS application that support the Matter Framework. My goal is to enable user to commission their Matter-enabled device to a fabric and control them through the fabric. However, I stumbled upon a few questions and areas that I would greatly appreciate guidance on:
Commission Process
What is the recommended steps to successfully commission a Matter-enabled device?
Using the Matter API
I have reviewed the provided sample app in the CHIP repo. However, I find it a bit complex to understand fully (background context: I am a junior developer and have never work on iOS development before).
I replicated the app using Swift since the sample is written in ObjC but often times got stuck on [connection] nw_read_request_report [C1] Receive failed with error "Operation timed out" log.
How to effectively use the Matter API to handle commissioning, device control and other interactions with Matter-enabled devices?
Keypair generation
I have noticed that the framework doesn't provide an API with the keypair generation (correct me if I am wrong). What is the best practice or resources for handling the keypair generation within the Matter context?
Matter Support vs Matter framework
I need clarification on the roles of these two framework. From my understanding, MatterSupport adds Matter devices into my ecosystem(?) while Matter framework handles the commission and control in the Matter fabric.
And we can use the Matter framework within the MatterSupport using the request handler to commission Matter-enabled device.
Post not yet marked as solved
We are building a matter wifi thermostat. The device is working well with Google and Alexa.
However, when add the device thru iOS Home App, the home app always show room temperature 0.0c.
When working with Google Home, the room temperature can show correctly.
Is there any problem with iOS Home App with Matter WiFi Thermostat?
Post not yet marked as solved
Our smart home app is integrating Matter as a way to add devices to the user's home. The implementation is pretty standard, here is the main part:
Code
var setupPayload: MTRSetupPayload?
if let onboardingPayload = onboardingPayload {
setupPayload = try MTRSetupPayload(onboardingPayload: onboardingPayload)
}
let topology = MatterAddDeviceRequest.Topology(
ecosystemName: ecosystemName,
homes: [MatterAddDeviceRequest.Home(displayName: homeDisplayName)])
let request = MatterAddDeviceRequest(topology: topology,
setupPayload: setupPayload)
do {
try await request.perform()
print("Success")
} catch {
print("Failure")
}
Issue
If the user decides to press the close button on the UI, the iOS treats it as a success. This use case messes with our flow as we have different paths in the app for success and failures.
I would normally expect that if the user cancels something there is a callback that enables the developers to handle it properly. I've researched a lot on this topic but unfortunately I wasn't able to find anything helpful.
Any advice on how to resolve this is much appreciated.
Thanks in advance
P.S.
Yes we have implemented the MatterRequestExtension and all the handlers, the commissioning part works fine, we are able to add a Matter device and control it with our app, this issue happens before scanning the QR code.
Post not yet marked as solved
Hi, I have tried to add Eve energy plug but still pairing failed, it reported always same error.
Error Domain=com.apple.MatterSupport Code=1 "(null)"
Could anyone help?
Regards
Post not yet marked as solved
How to commission a device to our fabric after adding it using Matter.Support
We have the following configuration:
eero border router
our own thermostat device that we are developing
no home pod or home TV are used
We have followed this guide
https://developer.apple.com/documentation/mattersupport/adding-matter-support-to-your-ecosystem
and implemented Matter Extension, as Matter.Framework is no more allowed to pair device.
In Matter Extension the following callbacks are fired:
override func selectThreadNetwork(from threadScanResults: [MatterAddDeviceExtensionRequestHandler.ThreadScanResult]) async throws -> MatterAddDeviceExtensionRequestHandler.ThreadNetworkAssociation
override func commissionDevice(in home: MatterAddDeviceRequest.Home?, onboardingPayload: String, commissioningID: UUID) async throws
In our demo app the following function completes without errors
try await request.perform()
The thermostat device seems to be successfully commissioned.
In https://developer.apple.com/documentation/mattersupport/adding-matter-support-to-your-ecosystem there is a comment that says:
Use Matter.Framework APIs to pair the accessory to your application with the provided onboardingPayload.
How should this thing be done ?
We tried to start the matter controller in the old way:
func start() -> Bool
{
if (self.matterController == nil)
{
let storage = MatterStorage.shared
let factory = MTRDeviceControllerFactory.sharedInstance()
let factoryParams = MTRDeviceControllerFactoryParams(storage: storage)
do
{
try factory.start(factoryParams)
}
catch
{
return false
}
let keys = FabricKeys()
let params = MTRDeviceControllerStartupParams(signing: keys, fabricId: UInt64(fabricId), ipk: keys.ipk)
params.vendorID = NSNumber(value: self.vendorId)
self.matterController = try? factory.createController(onExistingFabric: params)
let controllerNid = self.matterController?.controllerNodeID
if (self.matterController == nil)
{
self.matterController = try? factory.createController(onNewFabric: params)
}
}
return (self.matterController != nil)
}
Certificate are generated locally as in Matter Darwin example.
We tried to call
let params = MTRCommissioningParameters()
matterController?.commissionNode(withID: NSNumber(value: self.deviceNid), commissioningParams: params)
in commissionDevice of Matter Extension but we get error:
Invalid object state.