Access to Matter “characteristic” in a HomeKit app?

Hi there,

I am working on a (Mac Catalyst) HomeKit my own private application, which observes different characteristics of different accessories. This works (also thanks to the advice here, thanks again to all who helped!) like a charm.

Now I've found that one of my outlets which is connected through Matter supports power consumption (in Home.app), but there is no characteristic for that, all I can see is its power state. Self-evidently, access to the consumption would be something Matter-specific.

At this moment, to save time, I'd rather not study the complete Matter kit in detail if it can be dodged for this particular very limited goal. Is it possible just as simply as possible to read in (if readable) and observe (if observable) those extra Matter characteristics (if any) for an HMAccessory, presumably through its matterNodeID somehow? I'd be grateful for a sample code, if some is available (preferably ObjC, but of course Swift better'n nothing).

Thanks a lot!

Answered by DTS Engineer in 907330022

At this moment, to save time, I'd rather not study the complete Matter kit in detail if it can be dodged for this particular very limited goal. Is it possible just as simply as possible to read in (if readable) and observe (if observable) those extra Matter characteristics (if any) for an HMAccessory, presumably through its matterNodeID somehow?

It is, though you'll need to get your head around the device Matter configuration, which will probably involve some degree of wading through the Matter spec. The problem here is that Matter and HomeKit's accessory architectures are different enough in design and vocabulary that jumping between the two isn't trivial. This is also why HomeKit's support for Matter is tied to specifics instead of providing a more "generic" mapping solution- the specs are sufficiently different that there isn’t a good way to make a generic mapping “engine”.

In any case, this forum post goes through the full details, but the basic overview is that one of MTRDeviceController initializers actually creates a "bridge" into HomeKit's ecosystem controller (instead of creating your own). Once you have that controller, you can use it to create an MTRBaseDevice, which can then be used to communicate with the accessory using Matter.

I'd be grateful for a sample code, if some is available (preferably ObjC, but of course Swift better'n nothing).

I'm afraid I don't have anything I can share, but please let me know if you have any questions.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Accepted Answer

At this moment, to save time, I'd rather not study the complete Matter kit in detail if it can be dodged for this particular very limited goal. Is it possible just as simply as possible to read in (if readable) and observe (if observable) those extra Matter characteristics (if any) for an HMAccessory, presumably through its matterNodeID somehow?

It is, though you'll need to get your head around the device Matter configuration, which will probably involve some degree of wading through the Matter spec. The problem here is that Matter and HomeKit's accessory architectures are different enough in design and vocabulary that jumping between the two isn't trivial. This is also why HomeKit's support for Matter is tied to specifics instead of providing a more "generic" mapping solution- the specs are sufficiently different that there isn’t a good way to make a generic mapping “engine”.

In any case, this forum post goes through the full details, but the basic overview is that one of MTRDeviceController initializers actually creates a "bridge" into HomeKit's ecosystem controller (instead of creating your own). Once you have that controller, you can use it to create an MTRBaseDevice, which can then be used to communicate with the accessory using Matter.

I'd be grateful for a sample code, if some is available (preferably ObjC, but of course Swift better'n nothing).

I'm afraid I don't have anything I can share, but please let me know if you have any questions.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Thank you very much!

Thank you very much!

You're very welcome, and good luck!

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Well one more question please. I've found meantime I can read e.g., the Power Measurement cluster using

[mybasedevice readAttributesWithEndpointID:nil clusterID:@(0x90)  ...]

Are there symbolic constants which I could use instead of the ugly 0x90? Can't find them anywhere :(

Thanks again!

Access to Matter “characteristic” in a HomeKit app?
 
 
Q