I am working on an app for a Home automation device built on Matter. There are both standard and custom features/services/clusters on this device. HomeKit seems to pick up the standard ones except for one (leak detector) that is part of the Matter 1.3 spec. Of course HomeKit doesn't know what to do with the custom ones so they aren't shown in the Home app. I am trying to access those directly via calls to the Matter APIs so I can present them in a custom app. To access Matter APIs I am using a process suggested by DTS in a forum post that can be found here.
The MTRBaseDevice I obtain in the suggested way responds appropriately to read and write commands, but subscribe doesn't work as expected. It returns an error code 48 which is described as "The operation couldn’t be completed." and the source that contains the error calls it "operationNotSupported". This is the subscribe call referenced in the DTS response to earlier post, however there are three more "subscribe" methods and I have tried them all. Two also return an error 48, and the last one never calls any of the callback handlers providing no data or errors.
Since a subscription is supposed to return data periodically even when there have been no changes it doesn't seem that different than polling so I have written code for that and it works. However I don't expect iOS will let me poll in the background for alarm conditions and I am hoping subscription updates will be sent to a background app so it can notify users of these conditions. Is that a reasonable assumption?
Here is the code I am using to test subscribe, perhaps I am doing something wrong? Originally I had shorter intervals but changing them made no difference. Do they need to be longer?
let subscribeParams = MTRSubscribeParams(minInterval: 15, maxInterval: 900)
if #available(iOS 17.6, *) {
subscribeParams.shouldAssumeUnknownAttributesReportable = true
}
subscribeParams.shouldFilterByFabric = false
subscribeParams.shouldReplaceExistingSubscriptions = true
subscribeParams.shouldReportEventsUrgently = true
subscribeParams.shouldResubscribeAutomatically = false
print("Attempting subscribe:with")
let localClusterStateCache = MTRClusterStateCacheContainer()
matterBaseDevice.subscribe(with: OS_dispatch_queue_global.global(), params: subscribeParams, clusterStateCacheContainer: localClusterStateCache) { (attributes: [Any]) in
print("subscribe:with attributeHandler: \(attributes)")
} eventReportHandler: { (events: [Any]) in
print("subscribe:with eventHandler: \(events)")
} errorHandler: { (error: any Error) in
let reportingError = error as NSError
if reportingError.domain == "HMErrorDomain" {
let hkError = HMError(HMError.Code(rawValue: reportingError.code)!)
print("subscribe:with errorHandler: \(hkError.localizedDescription); UserInfo: \(hkError.userInfo); ErrorUserInfo: \(hkError.errorUserInfo)")
} else {
print("subscribe:with errorHandler: \(reportingError)")
}
} subscriptionEstablished: {
print("subscribe:with Subscription established!!!")
} resubscriptionScheduled: { (error: any Error, numericParam: NSNumber) in
print("subscribe:with Resubscription scheduled; error: \(error); numericParam: \(numericParam)")
}
HomeKit
RSS for tagCommunicate with, configure, and control home automation accessories using HomeKit.
Posts under HomeKit tag
44 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Hi, I wanted to start the central heating if the temperature is below a certain level, I am home and the time is in a range. I created an automation but it didn't fire. I think it's because the sensor condition is "Temperature Drops Below" not "Temperature Is Below". In other words because the temperature was already below the level at the time the time window opened, the automation didn't fire.
Does that sound correct? If so is it possible to do what I want which is to turn on the heating in the morning if it is cold?
I am using a Matter Device to do the OTA test with iPhone 8 Plus, HomePod mini, and the Home App. however, there is some abnormal behavior.
The problem is that:
The Matter device in the pop-up message is still the old firmware version after the OTA upgrade successfully. A few minutes later, the firmware version is updated in the device info but Apple Home still pop-up that a new firmware version is available for the Matter device with the same new version.
When I restart the HomePod mini, no more updates are available for my device. is the HomePod cached the firmware version?
The firmware version display format is incorrect? I remember the firmware format is in string e.g. 1.6.138. I could confirm this issue happened on HomePod mini V17.4. example:
The old firmware version of the Matter device should be 251689472 in number and 1.5.122.0 in string.
The new firmware version of the Matter device after OTA should be 1.6.138.0 in string and 268470784 in number
(OTA upgrade with new firmware version)
**Please let me know if more information is needed. **
Environment:
iPhone 8 Plus, IOS 16.7.5
Apple HomePod Mini V17.5
When I start the Homekit Accessory Simulator for Xcode 16.0 beta 2 I do not see the Robot Vacuum as an option.
I am working on an app for a home automation device.
If I were using HomeKit exclusively I could add custom services or custom characteristics on standard services and these things would all be reported to my app via HomeKit. There is sample code from Apple that demonstrates how to do this.
When a Matter device is commissioned using HomeKit you might expect custom clusters and/or custom attributes in a standard cluster would be translated to appropriate HomeKit services and characteristics, but this doesn't appear to be the case.
Is there a way to have HomeKit do this?
If not it seems I would need to use Matter directly rather than via HomeKit to access custom features. But if I commission the device using Matter in my app then I understand a new fabric is created and the device would not show in the Home app. Maybe the user needs to commission the device twice, once with my custom app and once with the Home app? That seems like a poor user experience to me. Perhaps that is the price paid for using a cross-platform standard?
Is there a better way to get the same level of customization using Matter that I am able to get using HomeKit?
Is there any api For Apple AirPods
I have an idea that will boost its usage
I found that some HomeKit accessories have an "MANUFACTURER" UI interface on the details page in the Home app (as shown in the red box in the accessory image). I developed my own HomeKit accessory and also developed a HomeKit accessory app, but my accessory does not have an "MANUFACTURER" UI interface on the details page in the Home app. What should I do to make my accessory have an "MANUFACTURER" UI interface on the accessory details page in the Home app?
I'm working on an app that uses HomeKit-enabled accessories such as wall plugs to control a photographic enlarger in a darkroom. This requires precise timing when toggling the power state of the plug. For example, the timer in my app might be set to 5 seconds, so I turn on the plug using writeValue() on the plugs power state characteristic, wait 5 seconds, then turn it off again.
I want to be able to measure if the plug actually responded to the command and if there was any delay in the plug actually turning on/off so I can display a warning to the user if network latency resulted in the plug being on for longer than the set time.
Does writeValue() (in my case, the async/await version) only return when the plug has been turned on, or does it return as soon as the command has been sent, regardless of if it has been received/acted on? Is there a way I can (a) quickly verify that the plug has been turned on/off, and (b) measure how long it took for the plug to act on the request, that is, the time elapsed between when writeValue() is called and when the plug actually updates to the corresponding value?
How did the issue (probably) occur?
The issue appeared in January 2024 after setting up a new Apple TV 4K (tvOS 16.X and updated to latest tvOS after setup) or a new Apple Watch Ultra 2 (watchOS 10.X and updated after setup). Both devices were set up using my personal iCloud and both were set up to use HomeKit. I suspect the issue is related to the creation of a new Home that was subsequently shared to a family member (see below).
How did I notice the issue?
From the week that followed, I noticed that my iPhone 15 Pro Max tends to get really hot in standby and that the battery drops significantly in the space of a couple standby hours. (Worst case I’ve experienced is about ~80% drop in 4 hours standby)
Apple Watch also has huge drops in battery life. Again, to give some perspective: I wear my AW for sleep tracking, sometimes AW will drop ~5% throughout the night, sometimes ~60% (and turn off if it was charged below 60%, making me lose my sleep tracking).
My iPad Pro occasionally loses ~30-50% charge over night in standby.
I went to the Battery section of the Settings app on my iPhone and iPad and could notice that about 50-75% of the time (over 24h that is), Home Accessories is running in the background. I could not confirm this on Apple Watch as the battery section of Settings does not show per app usage, however clear drops in battery percentage are noticeable from the graph.
What's the issue?
Seeing the issue arise on three of my four portable Apple devices, I decided to go check on my MacBook Pro M1 Max in Activity Monitor if the same behaviour was to be seen. I quickly realised that the Home Daemon (homed) is permanently running in background at (unusual) high usage. It is the top entry in CPU usage and Uptime.
Going into the Console app I can see that the homed daemon on macOS is throwing 3x-5x batches of the same 5 error messages each second. The errors are the following:
In the same Console app, connecting to my iPhone and my iPad, I can see the exact same errors occurring at approximately the same rate.
What is the issue in technical terms?
My CloudKit HomeKit config (com.apple.homekit.config) container is bricked and returns an internal server error
The homed/cloudd daemons do not have a backoff policy and retry fetching the CloudKit database instantly on failure. This leads to an infinite loop of network requests going out and draining my battery on all devices massively.
How did I try to solve the issue?
All these measures were unsuccessful:
Restarting all devices
All devices are on the latest version
Deleting the Home app where possible
Turning off Home, Keychain and iCloud Drive in iCloud settings
Signing out of iCloud and signing in again
Using the HomeKit Reset mobileconfig profile where possible (http://appldnld.apple.com/iOSProfiles/HomeKitReset.mobileconfig)
Use the previously mentioned reset profile in combination with a HomeKit Architecture downgrade (http://appldnld.apple.com/iOSProfiles/KeepLegacyHome.mobileconfig)
On macOS, delete ~/Library/HomeKit
Sending sysdiags using the Feedback Assistant (FB13529370, still open)
Manually revoking all (pending and accepted) home invitations and deleting all homes from the Home app
Removing all Apple TVs and HomePods from my iCloud account
Reseting and repairing Apple Watch
Disabled Advanced Data Protection on iCloud
Logging out of all my devices’ iCloud, use the reset profile, wait 20min, login to iCloud, the issue reappears in the console (while no other devices are logged in)
Changing Apple ID password and choose to log out all devices, log in again into a single device, use the reset profile, wait 20min, and the issue reappears in the console
To be absolutely sure it is an iCloud issue and not a local misconfiguration (that could be solved by resetting all my devices), I took an older iPhone 12 Pro and set it up as a new device with no apps/account/data, just a blank installation of iOS. As one would expect, the issue is not present and the Console app does not show any errors. As soon as I log into my iCloud account, the Home daemon homed throws the same 5 errors over and over and the battery draining issue magically appears.
This confirms my theory that it is indeed an iCloud issue on the server-side and not a client-side issue. Reseting my devices would not help fix the issue as demonstrated by a blank iOS installation on a separate iPhone 12 Pro getting the same error just by logging into my iCloud account.
I’ve had an Apple Support case for over five months, it has been (unsuccessfully) escalated twice to engineering. While many basic troubleshooting steps have been taken, nothing helped. Also, while the Apple Support agent is really trying their best to help me, they understand the symptoms of the problem but not the root cause which I tried explaining multiple times. Essentially we’re sticking to the Apple Support instructions they have, and doing basic diagnostics and battery troubleshooting even though I technically understand and can explain the issue to a CloudKit engineer.
We even proceeded to do a fresh install of macOS on a separate volume and took diagnostics before and after login in with my Apple ID. They were able to confirm that there is indeed a massive battery drain issue related to my account.
The case is still open but is currently leading nowhere, I'm just told to keep my devices updated...
How Apple can fix the issue:
Investigating the internal server error and fixing the record(s) or the CoreData entity that is throwing the problem
Implementing a client-side backoff policy for internal server errors coming from iCloud.
Quite trivially by reseting my com.apple.homekit.config container
Also worth mentioning:
I don’t use a VPN or any Proxy
I’m fine with losing all my HomeKit-related data on my iCloud account. At this point I just want the issue to disappear and to have useable battery life on all my devices. I’m giving my consent to the immediate and irrevocable deletion of all my past and present HomeKit-related data.
Hey there!
I'm thrilled about the latest from WWDC24.
I'm particularly keen on a feature announced for the HomeKit ecosystem called "Hands-free unlock".
I'm eager to learn more about how this feature operates and how I can integrate it into my locks and access control systems.
Could anyone please provide more details on how it works and how to implement it?
P.S - I wasn't able to find any information about this in the IOS 18 Developer release notes.
Hello all,
I have purchased 4 Homepod minis which update fine to public releases, I am currently on 17.4. I was testing with Apple and a patch is in the works so I wanted to test the beta software to see if it fixed my broken functionality within my homepods.
The error message is "Loading failed, couldn't communicate with the helper application. The process was probably suspended before it could launch properly" from within the home application on my iPhone.
I can update my other Apple devices to beta software either dev releases or public betas no problem. however, with the homepods, it just is not working.
I have removed 1 of the 4 homepods hard reset it and set it up again etc to no avail.
I phoned Apple support there solution was to try a different network or give it a shot on here.
I will try a different network however I do not have another Apple device which can establish a new accessory to my home i.e. another iPhone or an iPad.
Are there any known workarounds?
I have searched previously for a solution but all I got were results relating to Xcode and people-building applications. not related specifically to the home pod or homepodOS
Sorry if this has been posted in the wrong section of these forums.
Thank you all for the help.
Antonio.
I have AirPort Extreme connected via eth switch to my MacBook
And I have certified homekit device that broadcasting Apple IE as specified in the WAC Requirement document.
the Airport utility is not able to see my WAC device.
What I am missing?
In the WAC2 document, in the test scenario, the Airpot utility should see the homekit devices (WAC)
BTW: I can see the WAC devices with my iPhone as "SET UP New Device..."
I have a smart camera device that can be added as an accessory to a homeKit.
I want to implement a subset of functionalities of the smart camera behind a paid subscription or a paywall.
Anyone aware if this has been done before? i.e. conditionally exposing services on a Homekit accessory as a paid feature?
So far neither have I seen any such examples and also nowhere in the apple docs does it say that you can't. So looking for any information regarding this.
The questions are
Does apple support paid services in Homekit accessories?
If not, does it prevent people from implementing customized solutions?
Is there a good source of documentation on what IP ports and protocols are used by HomeKit accessories?
Hello everyone, I'm trying to configure my WAC device trough an App. This App finds the device without problems using startSearchingForUnconfiguredAccessoriesMatchingPredicate but when I try to use configureAccessory method I get only 3 messages in Xcode and nothing happens.
These messages are:
2024-03-14 12:55:56.261969+0000 App[1394:380785] ### WAC: -[EAWiFiUnconfiguredAccessoryBrowserManager configureAccessory:withConfigurationUIOnViewController:]_block_invoke_3:368 Other Region SKU
2024-03-14 12:55:56.266191+0000 App[1394:374248]
### WAC: _notificationCleanup:42 responseFlags: 3
### WAC: _notificationCleanup:43 responseFlags: 3
For me they don't look like an Error but would be nice if someone could give me some advice on this, I didn't find nothing about it.
Thanks in advance!
Hi all,
We are developing a Smart Home / IoT product that integrates into HomeKit. The integration is mostly done and interation with the product works great. We have only one problem: naming inside the home app.
Each time we add one of our devices to the home app, the services names are changed to the name of the accessory. Here is an example with the homekit tree:
Accessory
Service: Accessory Information
Characteristrics: name = "my accessory"
Service: Light Bulb
Characteristics: name = "light 1"
Service: Light Bulb
Characteristics: name = "light 2"
Service: Light Bulb
Characteristics: name = "light 3"
Service: Light Bulb
Characteristics: name = "light 4"
Service: Temperature Sensor
Characteristics: name = "temperature sensor 1"
When adding this device with 4 lights and 1 temperature sensor to homekit, all the services inside the app gets renamed "my accessory". They do not keep their name. It is especially strange since HomeKit knows about the names of the services since if I modify the name of the first light, HomeKit will suggest (in the background on the text input in gray) to rename it "light 1".
I know that my characteristics declaration are correct because I verified it with the HomeKit Accessory Tester.
What I can do so that the services offered by my device are not renamed to the name of the accessory itself ?
Thanks in advance.
My matter accessory define an endpoint of type light, with a custom cluster.
if I connect my accessory using Home app, I'm I supposed to find HMService/HMCharacteristic corresponding to my custom matter cluster?
Is there any requirement on the custom cluster to have it visible in HomeKit ?
Thanks.
Greetings!
I've added a Matter accessory via the Apple Home app. In my app, I'm attempting to commission this device and add it to my fabric. However, when I try to open the commissioning window, I receive an error stating, MTRBaseDevice doesn't support openCommissioningWindowWithDiscriminator over XPC.
It appears that opening a commissioning window via an XPC connection is not yet supported. Is there another method to commission the device? Can I retrieve the setup payload from the MTRBaseDevice object or the shared MTRDeviceController?
Here's the simplified version of my code:
var home: HMHome // HMHome received via HMHomeManager
var accessory: HMAccessory = home.accessory[0] // my Matter-supported accessory
let deviceController = MTRDeviceController.sharedController(
withID: home.matterControllerID as NSCopying,
xpcConnect: home.matterControllerXPCConnectBlock
)
let device = MTRBaseDevice(
nodeID: accessory.matterNodeID as NSNumber,
controller: deviceController
)
device.openCommissioningWindow(
withDiscriminator: 0,
duration: 900,
queue: .main) { payload, error in
if let payload {
// payload not received
} else if let error {
// I'm getting here "Error Domain=MTRErrorDomain Code=6 "(null)""
// and "MTRBaseDevice doesn't support openCommissioningWindowWithDiscriminator over XPC" logged in the console
print(error)
}
Dear All,
we have an old app that supports HomeKit. As company we exited the MFi program.
Now we need to update the app to do some minor changes (XCode update, recompilation and Font changes). No firmware changes.
Does it need to go through the certification process?
Thanks
Home App is not picking up current state, for example if I open the door I push button() to open and set current->setVal(2), the app shows it as opening, but if my door has obstruction the gate controller will stop and reverse automatically and the current->setVal(1) will be triggered as the gate closes by the sensor. Mean wile home app will say its still opening even though the current state has been set and notified as closed.