TuyaSmartHome Class Reference

Inherits from NSObject
Declared in TuyaSmartHome.h

Other Methods

  delegate

@property (nonatomic, weak) id<TuyaSmartHomeDelegate> delegate

  homeModel

@property (nonatomic, strong, readonly) TuyaSmartHomeModel *homeModel

  roomList

@property (nonatomic, copy, readonly) NSArray<TuyaSmartRoomModel*> *roomList

  deviceList

@property (nonatomic, copy, readonly) NSArray<TuyaSmartDeviceModel*> *deviceList

  groupList

@property (nonatomic, copy, readonly) NSArray<TuyaSmartGroupModel*> *groupList

  sharedDeviceList

@property (nonatomic, copy, readonly) NSArray<TuyaSmartDeviceModel*> *sharedDeviceList

  sharedGroupList

@property (nonatomic, copy, readonly) NSArray<TuyaSmartGroupModel*> *sharedGroupList

+ homeWithHomeId:

Init home

+ (instancetype)homeWithHomeId:(long long)homeId

Parameters

homeId

Home Id

Return Value

instance

Discussion

Init home

Declared In

TuyaSmartHome.h

– init

- (instancetype)init

– getHomeDetailWithSuccess:failure:

After init home, need to get home details 初始化 home 对象之后需要获取家庭的详情,homeModel,roomList,deviceList,groupList 才有数据

- (void)getHomeDetailWithSuccess:(void ( ^ ) ( TuyaSmartHomeModel *homeModel ))success failure:(TYFailureError)failure

Parameters

success

Success block

failure

Failure block

Discussion

After init home, need to get home details 初始化 home 对象之后需要获取家庭的详情,homeModel,roomList,deviceList,groupList 才有数据

Declared In

TuyaSmartHome.h

– updateHomeInfoWithName:geoName:latitude:longitude:success:failure:

Update home info,API version 3.0 修改家庭信息 API version 2.0

- (void)updateHomeInfoWithName:(NSString *)homeName geoName:(NSString *)geoName latitude:(double)latitude longitude:(double)longitude success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

homeName

Home name

geoName

City name

latitude

Lat

longitude

Lon

success

Success block

failure

Failure block

Discussion

Update home info,API version 3.0 修改家庭信息 API version 2.0

Declared In

TuyaSmartHome.h

– updateHomeInfoWithName:geoName:latitude:longitude:rooms:overWriteRoom:success:failure:

Update home info,API version 3.0 修改家庭信息 API version 3.0

- (void)updateHomeInfoWithName:(NSString *)homeName geoName:(NSString *)geoName latitude:(double)latitude longitude:(double)longitude rooms:(NSArray *)rooms overWriteRoom:(BOOL)overWriteRoom success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

homeName

Home name

geoName

City name

latitude

Lat

longitude

Lon

rooms

Room name array

overWriteRoom

NSDictionary now only support “overWriteRoom”:boolean

success

Success block

failure

Failure block

Discussion

Update home info,API version 3.0 修改家庭信息 API version 3.0

Declared In

TuyaSmartHome.h

– dismissHomeWithSuccess:failure:

Remove a home 解散家庭

- (void)dismissHomeWithSuccess:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

success

Success block

failure

Failure block

Discussion

Remove a home 解散家庭

Declared In

TuyaSmartHome.h

– sortDeviceOrGroupWithOrderList:success:failure:

order all device or group 对整个家庭下设备和群组进行排序

- (void)sortDeviceOrGroupWithOrderList:(NSArray<NSDictionary*> *)orderList success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

orderList

order list [@{@“bizId”: @“XXX”, @“bizType”: @“XXX”},@{@“bizId”: @“XXX”,@“bizType”: @“XXX”}] 其中bizId为设备的devId或群组的groupId, device的bizType = @“6” group的bizType = @“5”

success

Success block

failure

Failure block

Discussion

order all device or group 对整个家庭下设备和群组进行排序

Declared In

TuyaSmartHome.h

– addHomeRoomWithName:success:failure:

Add a new room 新增房间

- (void)addHomeRoomWithName:(NSString *)name success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

name

Room name

success

Success block

failure

Failure block

Discussion

Add a new room 新增房间

Declared In

TuyaSmartHome.h

– removeHomeRoomWithRoomId:success:failure:

Remove a room 解散房间

- (void)removeHomeRoomWithRoomId:(long long)roomId success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

roomId

Home Id

success

Success block

failure

Failure block

Discussion

Remove a room 解散房间

Declared In

TuyaSmartHome.h

– sortRoomList:success:failure:

Homes sort 房间排序

- (void)sortRoomList:(NSArray<TuyaSmartRoomModel*> *)roomList success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

roomList

Homes list

success

Success block

failure

Failure block

Discussion

Homes sort 房间排序

Declared In

TuyaSmartHome.h

– getHomeMemberListWithSuccess:failure:

Get home member list 获取家庭成员列表

- (void)getHomeMemberListWithSuccess:(void ( ^ ) ( NSArray<TuyaSmartHomeMemberModel*> *memberList ))success failure:(TYFailureError)failure

Parameters

success

Success block

failure

Failure block

Discussion

Get home member list 获取家庭成员列表

Declared In

TuyaSmartHome.h

– addHomeMemberWithAddMemeberRequestModel:success:failure:

Add a home member 添加家庭成员

- (void)addHomeMemberWithAddMemeberRequestModel:(TuyaSmartHomeAddMemberRequestModel *)requestModel success:(TYSuccessDict)success failure:(TYFailureError)failure

Parameters

requestModel

member model

success

Success block

failure

Failure block

Discussion

Add a home member 添加家庭成员

Declared In

TuyaSmartHome.h

– joinFamilyWithAccept:success:failure:

Accept or reject to shared home 接受或拒绝加⼊分享过来的家庭

- (void)joinFamilyWithAccept:(BOOL)accept success:(TYSuccessBOOL)success failure:(TYFailureError)failure

Parameters

accept

Whether to accept the invitation

success

Success block

failure

Failure block

Discussion

Accept or reject to shared home 接受或拒绝加⼊分享过来的家庭

Declared In

TuyaSmartHome.h

– addHomeMemberWithName:headPic:countryCode:userAccount:isAdmin:success:failure:

Add a home member 添加家庭成员 将会废弃

- (void)addHomeMemberWithName:(NSString *)name headPic:(UIImage *)headPic countryCode:(NSString *)countryCode userAccount:(NSString *)account isAdmin:(BOOL)isAdmin success:(TYSuccessDict)success failure:(TYFailureError)failure

Parameters

name

Member name

headPic

Member portrait

countryCode

Country code

account

User account

isAdmin

Whether the administrator

success

Success block

failure

Failure block

Discussion

Add a home member 添加家庭成员 将会废弃

Declared In

TuyaSmartHome.h

– addHomeMemberWithName:headPic:countryCode:userAccount:role:success:failure:

Add a home member 添加家庭成员

- (void)addHomeMemberWithName:(NSString *)name headPic:(UIImage *)headPic countryCode:(NSString *)countryCode userAccount:(NSString *)account role:(TYHomeRoleType)role success:(TYSuccessDict)success failure:(TYFailureError)failure

Parameters

name

Member name

headPic

Member portrait

countryCode

Country code

account

User account

role

home role type

success

Success block

failure

Failure block

Discussion

Add a home member 添加家庭成员

Declared In

TuyaSmartHome.h

Weather Methods

– geoName

home location 家庭地理位置

- (NSString *)geoName

Discussion

home location 家庭地理位置

Declared In

TuyaSmartHome+Weather.h

– getHomeWeatherSketchWithSuccess:failure:

get home weather simple summary parameters. Sush as city name, state of weather(clear, cloudy, rainy, and so on),weather icon. 获取家庭天气简要参数。该请求返回家庭所在城市的简要天气参数,如城市名称、当天的天气状况(晴、多云、雨等)、天气图片信息。

- (void)getHomeWeatherSketchWithSuccess:(void ( ^ ) ( TuyaSmartWeatherSketchModel *))success failure:(TYFailureError)failure

Parameters

success

request successful callback 请求成功回调

failure

request failed callback 请求失败回调

Discussion

get home weather simple summary parameters. Sush as city name, state of weather(clear, cloudy, rainy, and so on),weather icon. 获取家庭天气简要参数。该请求返回家庭所在城市的简要天气参数,如城市名称、当天的天气状况(晴、多云、雨等)、天气图片信息。

Declared In

TuyaSmartHome+Weather.h

– getHomeWeatherDetailWithOption:success:failure:

get home weather summary parameters. Such as tempature, humidity, ultraviolet index, air quality. 获取家庭天气详细参数,如温度、湿度、紫外线指数、空气质量等

- (void)getHomeWeatherDetailWithOption:(TuyaSmartWeatherOptionModel *)optionModel success:(void ( ^ ) ( NSArray<TuyaSmartWeatherModel*> *))success failure:(TYFailureError)failure

Parameters

optionModel

weather details unit configuration 天气详情参数单位配置

success

request successful callback 请求成功回调

failure

request failed callback 请求失败回调

Discussion

get home weather summary parameters. Such as tempature, humidity, ultraviolet index, air quality. 获取家庭天气详细参数,如温度、湿度、紫外线指数、空气质量等

optionModel can be nil.If nil, request would made using last request which is successful callback. If optionModel using only one confiuration, the other two configuration would use last successful request.

Different areas are use different weather services. Particularly, if location of current home account is in China, server would not return wind speed and pressure.

optionModel 可以为nil。若为nil,返回的参数会上一次请求成功的参数设置,若只改变一种单位设置进行请求,另外两种也依然会保留上一次请求成功的参数设置。

由于天气服务在不同地区的使用的服务不同,不同地区返回的参数有可能不同。 特别的,如果当前家庭账号位置在中国,那么不会返回风速和气压信息。

Declared In

TuyaSmartHome+Weather.h

BleMesh Methods

  meshModel

@property (nonatomic, strong, readonly) TuyaSmartBleMeshModel *meshModel

– getMeshListWithSuccess:failure:

获取家庭下的mesh列表

- (void)getMeshListWithSuccess:(void ( ^ ) ( NSArray<TuyaSmartBleMeshModel*> *list ))success failure:(TYFailureError)failure

Parameters

success

操作成功回调

failure

操作失败回调

Discussion

获取家庭下的mesh列表

Declared In

TuyaSmartHome+BleMesh.h

SIGMesh Methods

  sigMeshModel

@property (nonatomic, strong, readonly) TuyaSmartBleMeshModel *sigMeshModel

– getSIGMeshListWithSuccess:failure:

获取家庭下的 sig mesh 列表

- (void)getSIGMeshListWithSuccess:(void ( ^ ) ( NSArray<TuyaSmartBleMeshModel*> *list ))success failure:(TYFailureError)failure

Parameters

success

操作成功回调

failure

操作失败回调

Discussion

获取家庭下的 sig mesh 列表

Declared In

TuyaSmartHome+SIGMesh.h