mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 07:14:55 +00:00
Implement Flush Mounted Presence Sensor Routine Control and change the device type logic
This commit is contained in:
@ -88,6 +88,7 @@ mixin SceneLogicHelper {
|
||||
final task = actions[index];
|
||||
if (task.deviceId == 'delay') {
|
||||
return CreateSceneAction(
|
||||
productType: task.deviceType,
|
||||
entityId: actions[index].deviceId,
|
||||
actionExecutor: 'delay',
|
||||
executorProperty: CreateSceneExecutorProperty(
|
||||
@ -99,6 +100,7 @@ mixin SceneLogicHelper {
|
||||
}
|
||||
if (task.code == CreateSceneEnum.smartSceneSelect.name) {
|
||||
return CreateSceneAction(
|
||||
productType: task.deviceType,
|
||||
actionType: task.operationName.toLowerCase() == 'automation'
|
||||
? 'automation'
|
||||
: 'scene',
|
||||
@ -107,6 +109,7 @@ mixin SceneLogicHelper {
|
||||
executorProperty: null);
|
||||
}
|
||||
return CreateSceneAction(
|
||||
productType: task.deviceType,
|
||||
entityId: task.deviceId,
|
||||
actionExecutor: 'device_issue',
|
||||
executorProperty: CreateSceneExecutorProperty(
|
||||
@ -119,6 +122,20 @@ mixin SceneLogicHelper {
|
||||
),
|
||||
],
|
||||
);
|
||||
for (var action in createAutomationModel.actions) {
|
||||
if (action.productType == 'NCPS') {
|
||||
if (action.executorProperty!.functionCode == 'near_detection' ||
|
||||
action.executorProperty!.functionCode == 'far_detection') {
|
||||
action.executorProperty!.functionValue =
|
||||
(action.executorProperty!.functionValue * 100).round();
|
||||
} else if (action.executorProperty!.functionCode ==
|
||||
'presence_delay' ||
|
||||
action.executorProperty!.functionCode == 'none_delay') {
|
||||
action.executorProperty!.functionValue =
|
||||
action.executorProperty!.functionValue * 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
sceneBloc.add(CreateSceneWithTasksEvent(
|
||||
createSceneModel: null,
|
||||
updateScene: updateScene,
|
||||
@ -139,6 +156,7 @@ mixin SceneLogicHelper {
|
||||
final task = actions[index];
|
||||
if (task.deviceId == 'delay') {
|
||||
return CreateSceneAction(
|
||||
productType: task.deviceType,
|
||||
entityId: actions[index].deviceId,
|
||||
actionExecutor: 'delay',
|
||||
executorProperty: CreateSceneExecutorProperty(
|
||||
@ -150,11 +168,14 @@ mixin SceneLogicHelper {
|
||||
}
|
||||
if (task.code == CreateSceneEnum.smartSceneSelect.name) {
|
||||
return CreateSceneAction(
|
||||
productType: task.deviceType,
|
||||
entityId: actions[index].deviceId,
|
||||
actionExecutor: actions[index].functionValue,
|
||||
executorProperty: null);
|
||||
}
|
||||
|
||||
return CreateSceneAction(
|
||||
productType: task.deviceType,
|
||||
entityId: task.deviceId,
|
||||
actionExecutor: 'device_issue',
|
||||
executorProperty: CreateSceneExecutorProperty(
|
||||
@ -167,6 +188,20 @@ mixin SceneLogicHelper {
|
||||
),
|
||||
],
|
||||
);
|
||||
for (var action in createSceneModel.actions) {
|
||||
if (action.productType == 'NCPS') {
|
||||
if (action.executorProperty!.functionCode == 'near_detection' ||
|
||||
action.executorProperty!.functionCode == 'far_detection') {
|
||||
action.executorProperty!.functionValue =
|
||||
action.executorProperty!.functionValue * 100;
|
||||
} else if (action.executorProperty!.functionCode ==
|
||||
'presence_delay' ||
|
||||
action.executorProperty!.functionCode == 'none_delay') {
|
||||
action.executorProperty!.functionValue =
|
||||
action.executorProperty!.functionValue * 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
sceneBloc.add(CreateSceneWithTasksEvent(
|
||||
createSceneModel: createSceneModel,
|
||||
createAutomationModel: null,
|
||||
|
||||
Reference in New Issue
Block a user