TuyaSmartScene Class Reference

Inherits from NSObject
Declared in TuyaSmartScene.h

+ sceneWithSceneModel:

使用场景数据对象初始化一个TuyaSmartScene对象。 Initialize method of TuyaSmartScene.

+ (instancetype)sceneWithSceneModel:(TuyaSmartSceneModel *)sceneModel

Parameters

sceneModel

scene model.

Return Value

instance of TuyaSmartScene.

Discussion

使用场景数据对象初始化一个TuyaSmartScene对象。 Initialize method of TuyaSmartScene.

Declared In

TuyaSmartScene.h

– initWithSceneModel:

使用场景数据对象初始化一个TuyaSmartScene对象。 Initialize method of TuyaSmartScene.

- (instancetype)initWithSceneModel:(TuyaSmartSceneModel *)sceneModel

Parameters

sceneModel

scene model.

Return Value

instance of TuyaSmartScene.

Discussion

使用场景数据对象初始化一个TuyaSmartScene对象。 Initialize method of TuyaSmartScene.

Declared In

TuyaSmartScene.h

– init

不要使用init进行初始化。 Don’t initialize an instance with init methed.

- (instancetype)init

Return Value

This method will return an unavailable instance.

Discussion

不要使用init进行初始化。 Don’t initialize an instance with init methed.

Declared In

TuyaSmartScene.h

+ addNewSceneWithName:homeId:background:showFirstPage:conditionList:actionList:matchType:success:failure:

添加场景(已废弃) Add a scene,deprecated.

+ (void)addNewSceneWithName:(NSString *)name homeId:(long long)homeId background:(NSString *)background showFirstPage:(BOOL)showFirstPage conditionList:(NSArray<TuyaSmartSceneConditionModel*> *)conditionList actionList:(NSArray<TuyaSmartSceneActionModel*> *)actionList matchType:(TuyaSmartConditionMatchType)matchType success:(void ( ^ ) ( TuyaSmartSceneModel *sceneModel ))success failure:(TYFailureError)failure

Parameters

name

scene name

homeId

homeId

background

background image url

showFirstPage

show the scene in index page or not

conditionList

condition list

actionList

action list

matchType

Match all conditons/any conditon will execute the automation.

success

success block

failure

failure block

Discussion

添加场景(已废弃) Add a scene,deprecated.

Declared In

TuyaSmartScene.h

+ addNewSceneWithName:homeId:background:showFirstPage:preConditionList:conditionList:actionList:matchType:success:failure:

添加场景 Add a new scene.

+ (void)addNewSceneWithName:(NSString *)name homeId:(long long)homeId background:(NSString *)background showFirstPage:(BOOL)showFirstPage preConditionList:(NSArray<TuyaSmartScenePreConditionModel*> *)preConditionList conditionList:(NSArray<TuyaSmartSceneConditionModel*> *)conditionList actionList:(NSArray<TuyaSmartSceneActionModel*> *)actionList matchType:(TuyaSmartConditionMatchType)matchType success:(void ( ^ ) ( TuyaSmartSceneModel *sceneModel ))success failure:(TYFailureError)failure

Parameters

name

scene name

homeId

homeId

background

background image url

showFirstPage

show the scene in index page or not

preConditionList

preconditons, like valid time period.

conditionList

condition list

actionList

action list

matchType

Match all conditons/any conditon will execute the automation.

success

success block

failure

failure block

Discussion

添加场景 Add a new scene.

Declared In

TuyaSmartScene.h

+ addNewSceneWithSceneModel:homeId:success:failure:

添加场景,使用一个带有完整数据的sceneModel进行添加。 Add a new scene.Use a sceneModel with complete infomation of a scene.

+ (void)addNewSceneWithSceneModel:(TuyaSmartSceneModel *)sceneModel homeId:(long long)homeId success:(void ( ^ ) ( TuyaSmartSceneModel *sceneModel ))success failure:(TYFailureError)failure

Parameters

sceneModel

sceneModel

homeId

homeId

success

success block

failure

failure block

Discussion

添加场景,使用一个带有完整数据的sceneModel进行添加。 Add a new scene.Use a sceneModel with complete infomation of a scene.

Declared In

TuyaSmartScene.h

– modifySceneWithName:background:showFirstPage:conditionList:actionList:matchType:success:failure:

修改场景(已废弃) Edit a existed scene, deprecated.

- (void)modifySceneWithName:(NSString *)name background:(NSString *)background showFirstPage:(BOOL)showFirstPage conditionList:(NSArray<TuyaSmartSceneConditionModel*> *)conditionList actionList:(NSArray<TuyaSmartSceneActionModel*> *)actionList matchType:(TuyaSmartConditionMatchType)matchType success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

name

scene name

background

background image url

showFirstPage

show the scene in index page or not

conditionList

condition list

actionList

action list

matchType

Match all conditons/any conditon will execute the automation.

success

success block

failure

failure block

Discussion

修改场景(已废弃) Edit a existed scene, deprecated.

Declared In

TuyaSmartScene.h

– modifySceneWithName:background:showFirstPage:preConditionList:conditionList:actionList:matchType:success:failure:

修改场景 Edit a existed scene.

- (void)modifySceneWithName:(NSString *)name background:(NSString *)background showFirstPage:(BOOL)showFirstPage preConditionList:(NSArray<TuyaSmartScenePreConditionModel*> *)preConditionList conditionList:(NSArray<TuyaSmartSceneConditionModel*> *)conditionList actionList:(NSArray<TuyaSmartSceneActionModel*> *)actionList matchType:(TuyaSmartConditionMatchType)matchType success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

name

scene name

background

background image url

showFirstPage

show the scene in index page or not

preConditionList

preconditons, like valid time period.

conditionList

condition list

actionList

action list

matchType

Match all conditons/any conditon will execute the automation.

success

success block

failure

failure block

Discussion

修改场景 Edit a existed scene.

Declared In

TuyaSmartScene.h

– modifySceneWithSceneModel:success:failure:

修改一个已经存在的场景,使用一个带有完成信息的sceneModel修改场景。 Edit a existed scene. Use a sceneModel with complete infomation of a scene.

- (void)modifySceneWithSceneModel:(TuyaSmartSceneModel *)sceneModel success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

sceneModel

sceneModel

success

success block

failure

failure block

Discussion

修改一个已经存在的场景,使用一个带有完成信息的sceneModel修改场景。 Edit a existed scene. Use a sceneModel with complete infomation of a scene.

Declared In

TuyaSmartScene.h

– deleteSceneWithSuccess:failure:

删除场景。 Delete a scene.

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

Parameters

success

success callback

failure

failure callback

Discussion

删除场景。 Delete a scene.

Declared In

TuyaSmartScene.h

– executeSceneWithSuccess:failure:

执行场景 Execute a scene.

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

Parameters

success

success callback

failure

failure callback

Discussion

执行场景 Execute a scene.

Declared In

TuyaSmartScene.h

– disableSceneWithSuccess:failure:

设置一个自动化为关闭状态,不会自动触发。 Disable an automation, which will not executed automaticaly.

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

Parameters

success

success callback

failure

failure callback

Discussion

设置一个自动化为关闭状态,不会自动触发。 Disable an automation, which will not executed automaticaly.

Declared In

TuyaSmartScene.h

– enableSceneWithSuccess:failure:

设置一个自动化为生效状态。 Enable an automation, which will be executed whild the conditons are matched.

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

Parameters

success

success callback

failure

failure callback

Discussion

设置一个自动化为生效状态。 Enable an automation, which will be executed whild the conditons are matched.

Declared In

TuyaSmartScene.h

– cancelRequest

取消正在进行的操作。 Cancel the request being executed.

- (void)cancelRequest

Discussion

取消正在进行的操作。 Cancel the request being executed.

Declared In

TuyaSmartScene.h

– triggerRecommendSceneWithHomeId:success:failure:

执行一个推荐场景 Execute a recommended scene.

- (void)triggerRecommendSceneWithHomeId:(long long)homeId success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

homeId

homeId

success

success callback

failure

failure callback

Discussion

执行一个推荐场景 Execute a recommended scene.

Declared In

TuyaSmartScene.h

– removeRecommendSceneWithHomeId:success:failure:

删除一个推荐场景 Delete a recommended scene.

- (void)removeRecommendSceneWithHomeId:(long long)homeId success:(TYSuccessHandler)success failure:(TYFailureError)failure

Parameters

homeId

homeId

success

success callback

failure

failure callback

Discussion

删除一个推荐场景 Delete a recommended scene.

Declared In

TuyaSmartScene.h

– saveRecommendSceneWithHomeId:success:failure:

保存一个推荐场景,推荐场景可以在推荐的基础上做修改,保存成功后会变成普通场景,同时被保存的推荐场景也不再推荐。 Save a recommended scene, this scene can be modified by user. this scene will become a normal scene after save successfully, and the recommended scene will not show anymore.

- (void)saveRecommendSceneWithHomeId:(long long)homeId success:(void ( ^ ) ( TuyaSmartSceneModel *sceneModel ))success failure:(TYFailureError)failure

Parameters

homeId

homeId

success

success callback

failure

failure callback

Discussion

保存一个推荐场景,推荐场景可以在推荐的基础上做修改,保存成功后会变成普通场景,同时被保存的推荐场景也不再推荐。 Save a recommended scene, this scene can be modified by user. this scene will become a normal scene after save successfully, and the recommended scene will not show anymore.

Declared In

TuyaSmartScene.h