push switch autoaomtion status update

This commit is contained in:
ashrafzarkanisala
2024-07-28 06:57:33 +03:00
parent 50b455b4ae
commit eb8ad90dcb
12 changed files with 280 additions and 104 deletions

View File

@ -66,36 +66,40 @@ mixin SceneLogicHelper {
);
},
),
actions: List.generate(
actions.length,
(index) {
final task = actions[index];
if (task.deviceId == 'delay') {
actions: [
...List.generate(
actions.length,
(index) {
final task = actions[index];
if (task.deviceId == 'delay') {
return CreateSceneAction(
entityId: actions[index].deviceId,
actionExecutor: 'delay',
executorProperty: CreateSceneExecutorProperty(
functionCode: '',
functionValue: '',
delaySeconds: task.functionValue,
),
);
}
return CreateSceneAction(
entityId: actions[index].deviceId,
actionExecutor: 'delay',
entityId: task.deviceId,
actionExecutor: 'device_issue',
executorProperty: CreateSceneExecutorProperty(
functionCode: '',
functionValue: '',
delaySeconds: task.functionValue,
functionCode: task.code,
functionValue: task.functionValue,
delaySeconds: 0,
),
);
}
return CreateSceneAction(
entityId: task.deviceId,
actionExecutor: 'device_issue',
executorProperty: CreateSceneExecutorProperty(
functionCode: task.code,
functionValue: task.functionValue,
delaySeconds: 0,
),
);
},
)..add(CreateSceneAction(
entityId: smartSceneBloc.smartSceneEnable?.entityId ?? '',
actionExecutor:
smartSceneBloc.smartSceneEnable?.actionExecutor ?? '',
executorProperty: null)),
},
),
if (smartSceneBloc.smartSceneEnable != null)
CreateSceneAction(
entityId: smartSceneBloc.smartSceneEnable?.entityId ?? '',
actionExecutor:
smartSceneBloc.smartSceneEnable?.actionExecutor ?? '',
executorProperty: null)
],
);
sceneBloc.add(CreateSceneWithTasksEvent(
createSceneModel: null,
@ -121,36 +125,40 @@ mixin SceneLogicHelper {
unitUuid: HomeCubit.getInstance().selectedSpace!.id ?? '',
sceneName: sceneName.text,
decisionExpr: 'and',
actions: List.generate(
actions.length,
(index) {
final task = actions[index];
if (task.deviceId == 'delay') {
actions: [
...List.generate(
actions.length,
(index) {
final task = actions[index];
if (task.deviceId == 'delay') {
return CreateSceneAction(
entityId: actions[index].deviceId,
actionExecutor: 'delay',
executorProperty: CreateSceneExecutorProperty(
functionCode: '',
functionValue: '',
delaySeconds: task.functionValue,
),
);
}
return CreateSceneAction(
entityId: actions[index].deviceId,
actionExecutor: 'delay',
entityId: task.deviceId,
actionExecutor: 'device_issue',
executorProperty: CreateSceneExecutorProperty(
functionCode: '',
functionValue: '',
delaySeconds: task.functionValue,
functionCode: task.code,
functionValue: task.functionValue,
delaySeconds: 0,
),
);
}
return CreateSceneAction(
entityId: task.deviceId,
actionExecutor: 'device_issue',
executorProperty: CreateSceneExecutorProperty(
functionCode: task.code,
functionValue: task.functionValue,
delaySeconds: 0,
),
);
},
)..add(CreateSceneAction(
entityId: smartSceneBloc.smartSceneEnable?.entityId ?? '',
actionExecutor:
smartSceneBloc.smartSceneEnable?.actionExecutor ?? '',
executorProperty: null)),
},
),
if (smartSceneBloc.smartSceneEnable != null)
CreateSceneAction(
entityId: smartSceneBloc.smartSceneEnable?.entityId ?? '',
actionExecutor:
smartSceneBloc.smartSceneEnable?.actionExecutor ?? '',
executorProperty: null)
],
);
sceneBloc.add(CreateSceneWithTasksEvent(
createSceneModel: createSceneModel,