I'm device manufacturer and in future planning to get my device matter certified. If I want my device data for analytics purpose into my cloud than what is the best way possible.
First off, it's important to understand that the capability of accessories is ENORMOUSLY variable. One end of the spectrum are accessories like light switches which are generally designed to be as inexpensive as possible and which tend to be extremely resource limited. At the other end of the spectrum are things like smart TV or many camera which are effectively independant computers, capable of largely independant operation. Where your accessory sits on that spectrum largely defines what's possible. At the "high end", many of these accessories have their own "backend" network implementation which operates outside the standard ecosystem platform. On the other hand, many "low end" accessories have minimal to no logging/telemetry support as a way to reduce accessory cost.
Next, let me move to here and worth through the details of what's possible on our platform:
The homekit sdk and matter support mentioned here
https://developer.apple.com/apple-home/matter, are these two same
thing?
First off, on the hardware side, we basically support to smart home protocols:
-
HomeKit Accessory Protocol ("HAP"), which is licensed through MFi program and which is the original platform supported HomeKit.
-
Matter, which is a newer platform managed through a standards body.
On the software side, the HomeKit framework provides the abstraction layer that apps use to interact with both the overall "Home" configuration as well as specific accessories. This includes both direct control (like sending specific commands) and broader configurations (like configuring automations).
Digging into more details:
-
Our support for Matter is not currently equivalent to our support for HAP, so there are still many accessories which can really only be implemented through HAP. The exact state of that support is not documented, so if you're concerned about this issue I'd recommend testing a prototyping before you commit to a particular architecture.
-
Part of Matter's design is that accessories can support multiple "ecosystems", allowing the same accessory to be managed and controlled by more than one software platform. Note that ecosystem pairing is what the MatterSupport framework supports by providing a common interface for pairing the same accessory into multiple ecosystems.
-
As a separate feature, the HomeKit framework can be used to directly send matter commands. The API set is somewhat limited, but it is useful when the accessory vendor only needs to send specific commands and does not want to implement their own ecosystem.
-
By design, the HomeKit framework cannot be used in the background. Similarly, while the matter framework can be used by a backgrounded app, the system does not provide any broader support for this.
All of that leads to here:
My research says that the most latest approach suggested by apple is, developing a custom mobile app using device homekit sdk and subscribe to device state and send it to my cloud.
What you're describing above will not work. By design, HomeKit does not notify backgrounded apps of accessory activity and never has. This was a intentional design choice, as:
-
The HomeKit framework is actually designed around a shared "database" which is used to store "all" of the home configuration (including things like automations). Allowing direct access would reduce the reliability of that approach.
-
Allowing background access opens the door to individual app on individual devices monitoring accessories and sending commands based on those changes. While that approach is quite powerful, it is a usability NIGHTMARE in an environment with a large number of users and devices.
If I go that route, will it work even though the device was onboarded via homekit app and homekit hub device is also there. I want to make sure that both path will be active, device to hub to home app and device to custom app to my cloud, and both on matter ecosystem.
In practice, the general expectation is that ecosystem vendors will either their have own independant controller hardware in the home or they'll only interact with those accessories while their app happens to be in the foreground.
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware