feat: add fail closed automation evaluation
This commit is contained in:
+4
-2
@@ -191,11 +191,13 @@ class SceneEditorViewModel @Inject constructor(
|
||||
}
|
||||
|
||||
fun addDeviceStateTrigger(deviceName: String, expectedState: String) {
|
||||
val parsedState = runCatching { SocketPowerState.valueOf(expectedState.trim().uppercase()) }.getOrNull()
|
||||
?: return
|
||||
val trigger = SceneTrigger.DeviceState(
|
||||
id = SceneTriggerId(UUID.randomUUID().toString()),
|
||||
deviceName = DeviceName(deviceName),
|
||||
expectedState = expectedState,
|
||||
label = "$deviceName 状态变为 $expectedState",
|
||||
expectedState = parsedState,
|
||||
label = "$deviceName 状态变为 ${parsedState.name}",
|
||||
)
|
||||
_state.update { it.copy(triggers = it.triggers + trigger) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user