Home Management

Last Updated on : 2023-10-07 10:22:56download

The home management module in the BizBundle SDK encapsulates and extends the home management services on top of the Smart Life App SDK. It focuses on home-based information management, covering homes, rooms, members, and devices.

Capabilities

Home management services support the following capabilities:

  • Query the list of homes. Add, modify, and remove a home.
  • Manage the home name and geographical location, and query weather data.
  • Manage the list of home members. Add, delete, and invite a member.
  • Manage the list of rooms. Add, delete, and sort a room.
  • Add and remove a listener for changes in homes and device status.
  • Sort devices by home and room.

Example

Use the singleton classes ThingSmartFamilyBiz, ThingSmartRoomBiz, and ThingSmartMemberBiz to manage homes, rooms, and members.

// Register observer
[[ThingSmartFamilyBiz sharedInstance] removeObserver:observer];
[[ThingSmartRoomBiz sharedInstance] removeObserver:observer];

// Get family list
[[ThingSmartFamilyBiz sharedInstance] getFamilyListWithSuccess:^(NSArray<ThingSmartHomeModel *> *homes) {

	} failure:^(NSError *error) {

}];

/// Get room list
[[ThingSmartRoomBiz sharedInstance] getRoomListWithHomeId:homeId success:^(NSArray<ThingSmartRoomModel *> *roomList) {

	} failure:^(NSError *error) {

}];

/// Get member list
[[ThingSmartMemberBiz sharedInstance] getHomeMemberListWithHomeId:homeId success:^(NSArray<ThingSmartHomeMemberModel *> * _Nonnull list) {

    } failure:^(NSError *error) {

}];

Error codes

Global error codes

Error codes Description
IS_BLANK Request parameter is empty.
OVER_LENGTH Request parameter exceeds the length limit.
ILLEGAL Request parameter is invalid.
PERMISSION_DENIED No permission.
PERMISSION_VALIDATE_FAILED No permission.
GROUP_MANAGEMENT_DISABLED No permission to manage the home.
NUMEN_SERVER_BUSY Server is busy.

Home module error codes

API name Error codes Description
Create a home USER_ROOM_NAME_OUT_LENGTH Home name exceeds the length limit.
Dismiss a home GROUP_HAVE_SERVICE Purchased value-added service exists. Dismiss denied.
Create a default home ACQUIRE_LOCK_FAIL A default home already exists. Unable to create two default homes.
GROUP_ALREADY_EXISTS A home already exists. Unable to create a default home.
Modify home information NOT_EXISTS The home does not exist.
ACQUIRE_LOCK_FAIL Unable to modify the same home simultaneously.
Transfer a home USER_GROUP_MEMBER_IS_DELETE The user is not a member of the home.
ALREADY_GROUP_OWNER The user is already the home owner.
USER_NOT_ACCEPT The user does not accept the home invitation.
Remove a member REMOVE_ALL_BEFORE_LEAVING Only one member exists in the home. Deleting is not allowed.
Add a home member MEMBER_FOR_ACCOUNT_NOT_EMPTY User account cannot be empty when adding an admin or custom user.
CAN_NOT_ADD_NOT_SMART_HOME_VERSION_USER Unable to add a member who uses an app based on Smart Life App SDKs earlier than v3.0.
USER_IS_IN_FAMILY_GROUP The user is already a member of the home.
GROUP_NOT_EXIST The home does not exist.
Update member information USER_NOT_EXISTS The user does not exist.
USER_NOT_ACCEPT The user does not accept the home invitation.
USER_GROUP_MEMBER_IS_DELETE The user is not a member of the home.
Link an account CAN_NOT_ADD_NOT_SMART_HOME_VERSION_USER Unable to add a member who uses an app based on Smart Life App SDKs earlier than v3.0.
USER_IS_IN_FAMILY_GROUP The user is already a member of the home.
GROUP_NOT_EXIST The home does not exist.
Invite a member INVITATION_CODE_FOR_LOCATION_OVER_LIMIT The number of invitation codes exceeds the limit.
Add a member with an invitation code REACH_ACCESS_LIMIT The number of invitation codes exceeds the limit.
USER_NOT_EXISTS The user does not exist.
GROUP_NOT_EXIST The home does not exist.
USER_IS_IN_FAMILY_GROUP The user is already a member of the home.
Invite a member again INVITATION_CODE_INVALID_OR_NOT_EXIST The invitation code does not exist.
Add a room NOT_EXISTS The home does not exist.
USER_ROOM_NAME_OUT_LENGTH Home name exceeds the length limit.
ROOM_MAX_LIMIT_200 The number of rooms exceeds the limit.
Organize devices or groups by room INVALID_INPUT Input parameter is invalid.
Update a room name USER_ROOM_NAME_OUT_LENGTH Home name exceeds the length limit.