Hello,
I am currently working on personal project based on Matter. I need to create a Basic Video Player as specified in Matter's standard embedding the Media Playback Cluster.
I went through the reading of how Apple now supports Matter as a standard :
My understanding of the following schematic, is alongside :
- HomeKit Accessory Protocol (HAP) Framework API
-
- Related HAP accessories underneath the homeKit framework.
Developpers also find under the Homekit framework :
- CHIP (Connected Home IP) Framework API
-
- Related Matter accessories this time
Both types of accessories/devices can be commissioned in the HomeKit ecosystem seemlessly.
Each framework has it's documentation :
- HAP : https://developer.apple.com/documentation/homekit/hmhomemanager
- CHIP : https://developer.apple.com/documentation/matter
I want through the process of installing XCode and the HomeKit Accessory Simulator. In the list of HomeKit Accessories I did not see any Media related devices :
The list of currently supported devices is limited as I read here and will be enriched with time : https://support.apple.com/en-us/102135#:~:text=The%20Home%20app%20currently%20supports,%2C%20temperature%2C%20and%20humidity).
In the meantime, as I read the matter documentation, I read several references made to the Media Playback :
-
https://developer.apple.com/documentation/matter/mtrclustermediaplayback
-
https://developer.apple.com/documentation/matter/mtrbaseclustermediaplayback
My questions are :
-
Are Matter Basic Video Players, (Media Playback) supported in HomeKit ?
-
Why aren't they listed in HomeKit Accessory Simulator ?
-
How can I add a Basic Video Player in HomeKit and display it's Media Playback controls once I have added the device to HomeKit ?
Thank you for your Answer.
Regards
David
First off, a comment here:
Both types of accessories/devices can be commissioned in the HomeKit ecosystem seamlessly.
Each framework has its documentation: HAP: https://developer.apple.com/documentation/homekit/hmhomemanager CHIP: https://developer.apple.com/documentation/matter
While the frameworks are conceptually similar, I think it's a mistake to think of them as direct equivalents to each other.
The Matter framework is the easier of the two to explain— it's a hardware control framework you use to send commands to Matter accessories. There's a little bit of nuance in that you need to do pairing through the MatterSupport framework, but once you're paired, the behavior of the framework is relatively straightforward.
However, that's not really how HomeKit works. HomeKit works at a much higher level than that and is basically manipulating the "Home Ecosystem" that's built "on top" of HomeKit. So, for example, when you call a "basic" API like HMCharacteristic.writeValue(...), what that actually "does" could be one of at least three different things:
-
The device your app is running on connects to the accessory and writes the characteristic.
-
The device your app is running on sends a request to the current HomeHub, and the HomeHub writes the characteristic.
-
The device your app is running on sends a command to iCloud, the HomeHub receives that command, and the HomeHub then writes the characteristic.
...and which of those three happened is totally invisible to your app.
Finally, the other issue here is that the HomeKit framework also provides limited support for using the Matter framework to send commands to Matter accessories. In other words, instead of writing an ecosystem app that maintains its own pairing, you can connect to the accessory through HomeKit's ecosystem pairing. This forum post describes how that process works, while this one discusses one of its major limitations.
However, for your purposes, I believe the biggest issue is that I think you'd need to send all your commands directly through MTRBaseDevice, instead of being able to use the higher-level MTRClusterMediaPlayback.
Reordering questions a bit for clarity...
Why aren't they listed in HomeKit Accessory Simulator?
So, what the"HomeKit Accessory Simulator” actually does is simulate HAP (HomeKit Accessory Protocol) accessories. Indeed, one of its main uses is allowing HAP accessory developers to see what a given HAP accessory "should" look like, as well as allowing accessory developers to quickly experiment with different service configurations that will look in HomeKit.
I'll also note that the tools haven’t been updated in several years, so there are HAP accessories that it does not support (for example, televisions).
Are Matter Basic Video Players, (Media Playback) supported in HomeKit?
No, at least not directly. Going back to the support link you posted, in terms of the Matter specification:
"The Home app currently supports these types of Matter accessories: air conditioners, bridges, lights, locks, outlets, switches, thermostats, blinds and shades, and sensors (motion, ambient light, contact, temperature, and humidity)."
...that is a list of the cluster configuration HomeKit (and Home.app) support. However, two notes on that point:
-
Matter accessories are made up of collections of clusters and HomeKit will pair with an accessory even when it doesn't support everything it provides. FYI, this is actually very common, as many accessories include things like vendor-specific configurations.
-
I'm honestly not sure what will happen if you try and pair an accessory where HomeKit doesn't support ANY of its configuration, but I suspect HomeKit will pair the accessory but won't really "show it" in the home. That's something you need to try for yourself.
How can I add a Basic Video Player in HomeKit and display its Media Playback controls once I have added the device to HomeKit?
I don't think this is possible. Please file a bug on this and post the bug number back here once it's filed.
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware