Matter Category SDK Usage

1. Overview

This document mainly introduces how to use the Matter Category SDK to configure the Aqara Matter hub and Matter sub-devices.

PS: Currently, Matter sub-devices cannot be directly access net and connected through the SDK. They must first be connected via an Aqara Matter hub (using Aqara’s private Magic Pair protocol) before device access net and control can be performed.

2. Prerequisites

  1. Complete the preparation work.
  2. Complete the environment setup.
  3. Complete the integration of the Matter Vertical Category SDK.

3. Usage

The network configuration and device control of Matter sub-devices depend on the Aqara Matter hub. Therefore, a Matter hub must be added to the network before configuring or controlling Matter sub-devices.

3.1 Initialize Network Configuration Info

/**
     Config Device Access Net Info
     */
    [LMAccessNetUISDK.sharedInstance setTimeZone:@"Your TimeZone"]; // "GMT+08:00"
    [LMAccessNetUISDK.sharedInstance setTimeZoneName:@"Your TimeZone Name"];  // "Asia/Shanghai"
    [LMAccessNetUISDK.sharedInstance setAccessNetHomeId:@"Your HomeId]; // Required
    [LMAccessNetUISDK.sharedInstance setAccessNetHomeName:@"Your HomeName"]; // Optional
    [LMAccessNetUISDK.sharedInstance setAccessNetRoomId:@"Your RoomId"]; // Optional
    [LMAccessNetUISDK.sharedInstance setAccessNetRoomName:@"Your RoomName"]; // Optional
    /**
     Matter Required
     */
    [LMAccessNetUISDK.sharedInstance setEcosystemName:@"Your Apple Home Name"];
    [LMAccessNetUISDK.sharedInstance setAppGroupId:@"Your App GroupId"];
/**
     Config Device Access Net Info
     */
    LMAccessNetUISDK.sharedInstance().setTimeZone("Your TimeZone") // "GMT+08:00"
    LMAccessNetUISDK.sharedInstance().setTimeZoneName("Your TimeZone Name") // "Asia/Shanghai"
    LMAccessNetUISDK.sharedInstance().setAccessNetHomeId("Your HomeId") // Required
    LMAccessNetUISDK.sharedInstance().setAccessNetHomeName("Your HomeName") // Optional
    LMAccessNetUISDK.sharedInstance().setAccessNetRoomId("Your RoomId") // Optional
    LMAccessNetUISDK.sharedInstance().setAccessNetRoomName("Your RoomName") // Optional
    /**
     Matter Required
     */
    LMAccessNetUISDK.sharedInstance().setEcosystemName("Your Apple Home Name")
    LMAccessNetUISDK.sharedInstance().setAppGroupId("Your App GroupId")

Important

When connecting Matter devices, it is necessary to ensure that the App GroupId of the host project is same with the App GroupId of MatterExtension.

Parameters

Field Type Description Source
TimeZone String TimeZone -
TimeZoneName String TimeZone Name -
homeId String Home ID Obtained via API, see Aqara Developer Platform
homeName String Home Name Optional
roomId String Room ID Optional
roomName String Room Name Optional
ecosystemName String Apple Home Name -
appGroupId String App Group ID ID used for synchronizing data between the host app and Extension

3.2 Aqara Matter Hub/Sub-device Network Configuration

    __weak typeof(self) weakSelf = self;
    // Access net result callback
    LMAccessNetUISDK.sharedInstance.accessNetCallBack = ^(id  _Nonnull response, NSError * _Nonnull error, __kindof UIViewController * _Nonnull controller) {
        if (error) {
            [LHTipsUtils showError:error];
        } else {
            [LMAccessNetUISDK.sharedInstance popToPreAccessNetPage];
        }
    };
    // Access net,parameter is device model
    [[LMAccessNetUISDK sharedInstance] presentSingleDeviceAccessNetWithModel:@"Your Device Model" completion:^(UIViewController * _Nonnull controller, NSError * _Nonnull error) {
        if (error){
            [LHTipsUtils showError:error];
        } else {
            LMNavigationController *nc = [[LMNavigationController alloc] initWithRootViewController:controller];
            nc.modalPresentationStyle = UIModalPresentationOverFullScreen;
            [weakSelf.navigationController presentViewController:nc animated:YES completion:nil];
        }
    }];
// Access net result callback
LMAccessNetUISDK.sharedInstance().accessNetCallBack = { response, error, vc in
            if let e = error {
                LHTipsUtils.showError(e)
            } else {
                LMAccessNetUISDK.sharedInstance().popToPreAccessNetPage()
            }
        }

// Access net,parameter is device model
LMAccessNetUISDK.sharedInstance().presentSingleDeviceAccessNet(withModel: model) {
            [weak self] vc, error in
            if let rootVc = vc {
                let nc = LMNavigationController(rootViewController: rootVc)
                nc.modalPresentationStyle = .overFullScreen
                self?.navigationController?.present(nc, animated: true)
            } else if let e = error {
                LHTipsUtils.showError(e)
            }
        }

Parameters

Field Type Description Source
deviceModel String device model See Appendix Supported Matter Sub-Device List
lumi LogoCopyright © 2023 Lumi United Technology Co., Ltd. all right reserved,powered by GitbookFile Modify: 2025-11-10 11:05:08

results matching ""

    No results matching ""