Room Scene Management

Last Updated on : 2024-08-28 01:53:07download

Sort and bulk remove and set scenes in a room.

Bulk remove scenes from a room

API description

fun removeRoomRules(relationId: Long, roomId: String, ruleIds: String, listener: IResultCallback<Boolean?>?)

Parameters

Property Type Description
relationId Long The home ID.
roomId String The room ID.
ruleIds String The rule ID, with multiple IDs separated by a comma (,).
listener IResultCallback<Boolean?>? The callback.

Example

// sceneIdList is the list of scene IDs
val ruleIds : String = if (sceneIdList.isNullOrEmpty().not()) {
    val temp = sceneIdList.fold(StringBuilder()) { builder, sceneId ->
        builder.append(sceneId).append(",")
    }.toString()
    if (temp.endsWith(",")) {
        temp.substring(0, temp.length - 1)
    } else {
        temp
    }
} else {
    ""
}

sceneService.extService().removeRoomRules(relationId, roomId, ruleIds, listener)

Sort scenes in a room

API description

fun sortRoomRule(relationId: Long, roomId: String, ruleIds: String, listener: IResultCallback<Boolean?>?)

Parameters

Property Type Description
relationId Long The home ID.
roomId String The room ID.
ruleIds String The rule ID, with multiple IDs separated by a comma (,).
listener IResultCallback<Boolean?>? The callback.

Example

// sceneIdList is the list of scene IDs
val ruleIds : String = if (sceneIdList.isNullOrEmpty().not()) {
    val temp = sceneIdList.fold(StringBuilder()) { builder, sceneId ->
        builder.append(sceneId).append(",")
    }.toString()
    if (temp.endsWith(",")) {
        temp.substring(0, temp.length - 1)
    } else {
        temp
    }
} else {
    ""
}

sceneService.extService().sortRoomRule(relationId, roomId, ruleIds, listener)

Bulk set rooms for a scene

API description

fun modifyRoomBatchSceneData(relationId: Long, ruleIds: String, roomIds: String, callback: IResultCallback<Boolean?>?)

Parameters

Property Type Description
relationId Long The home ID.
roomIds String The room ID, with multiple IDs separated by a comma (,).
ruleIds String The rule ID, with multiple IDs separated by a comma (,).
listener IResultCallback<Boolean?>? The callback.

Example

// roomIdList is the list of room IDs
val roomIds: String = if (roomIdList.isNullOrEmpty().not()) {
    val temp = roomIdList.fold(StringBuilder()) { builder, roomId ->
        builder.append(roomId).append(",")
    }.toString()
    if (temp.endsWith(",")) {
        temp.substring(0, temp.length - 1)
    } else {
        temp
    }
} else {
    ""
}
// sceneIdList is the list of scene IDs
val sceneIds: String = if (sceneIdList.isNullOrEmpty().not()) {
    val temp = sceneIdList.fold(StringBuilder()) { builder, sceneId ->
        builder.append(sceneId).append(",")
    }.toString()
    if (temp.endsWith(",")) {
        temp.substring(0, temp.length - 1)
    } else {
        temp
    }
} else {
    ""
}

sceneService.baseService().modifyRoomBatchSceneData(relationId, sceneIds, roomIds, listener)