mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-23 10:37:56 +00:00
add water heater device to routine and fix device type in routine
This commit is contained in:
@@ -178,7 +178,8 @@ class DeviceManagerBloc extends Bloc<DeviceManagerEvent, DeviceManagerState> {
|
||||
DeviceType.CeilingSensor,
|
||||
DeviceType.ThreeGang,
|
||||
DeviceType.OneGang,
|
||||
DeviceType.TwoGang
|
||||
DeviceType.TwoGang,
|
||||
DeviceType.WH
|
||||
};
|
||||
|
||||
return devices
|
||||
|
||||
@@ -159,6 +159,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
||||
// Add new element if it doesn't exist in either list
|
||||
if (!updated) {
|
||||
var newElement = SceneStaticFunction(
|
||||
deviceType: event.deviceType,
|
||||
operationName: event.operation,
|
||||
deviceName: event.deviceName,
|
||||
icon: event.icon,
|
||||
@@ -192,6 +193,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
||||
if (element.code == event.deviceControlModel.code) {
|
||||
// Update the existing function with new values
|
||||
var updatedElement = element.copyWith(
|
||||
deviceType: element.deviceType,
|
||||
operationName: event.operation,
|
||||
deviceName: event.deviceName,
|
||||
icon: event.icon,
|
||||
@@ -217,6 +219,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
||||
}
|
||||
if (!updated) {
|
||||
var newElement = SceneStaticFunction(
|
||||
deviceType: event.deviceType,
|
||||
operationName: event.operation,
|
||||
deviceName: event.deviceName,
|
||||
icon: event.icon,
|
||||
|
||||
@@ -24,6 +24,7 @@ class TempHoldSceneTasksEvent extends CreateSceneEvent {
|
||||
final String uniqueId;
|
||||
final bool? isAutomation;
|
||||
final OperationDialogType operationType;
|
||||
final String deviceType;
|
||||
|
||||
const TempHoldSceneTasksEvent({
|
||||
required this.deviceControlModel,
|
||||
@@ -34,6 +35,7 @@ class TempHoldSceneTasksEvent extends CreateSceneEvent {
|
||||
required this.uniqueId,
|
||||
this.isAutomation,
|
||||
required this.operationType,
|
||||
required this.deviceType,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -46,6 +48,7 @@ class TempHoldSceneTasksEvent extends CreateSceneEvent {
|
||||
uniqueId,
|
||||
deviceName,
|
||||
icon,
|
||||
deviceType
|
||||
];
|
||||
}
|
||||
|
||||
@@ -149,7 +152,8 @@ class FetchSceneTasksEvent extends CreateSceneEvent {
|
||||
final String sceneId;
|
||||
final bool isAutomation;
|
||||
|
||||
const FetchSceneTasksEvent({this.isAutomation = false, required this.sceneId});
|
||||
const FetchSceneTasksEvent(
|
||||
{this.isAutomation = false, required this.sceneId});
|
||||
|
||||
@override
|
||||
List<Object> get props => [sceneId, isAutomation];
|
||||
|
||||
@@ -41,6 +41,7 @@ class SmartSceneSelectBloc
|
||||
.read<CreateSceneBloc>();
|
||||
|
||||
createSceneBloc.add(TempHoldSceneTasksEvent(
|
||||
deviceType: '',
|
||||
deviceControlModel: DeviceControlModel(
|
||||
deviceId: smartSceneEnable?.entityId ?? '',
|
||||
code: CreateSceneEnum.smartSceneSelect.name,
|
||||
|
||||
@@ -7,6 +7,7 @@ class OneGangHelperFunctions {
|
||||
String deviceId, String deviceName, functionValue) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
deviceType: '1G',
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
@@ -22,6 +23,7 @@ class OneGangHelperFunctions {
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceType: '1G',
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
@@ -40,6 +42,7 @@ class OneGangHelperFunctions {
|
||||
String deviceId, String deviceName, functionValue) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
deviceType: '1G',
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
@@ -55,6 +58,7 @@ class OneGangHelperFunctions {
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceType: '1G',
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
|
||||
@@ -7,6 +7,7 @@ class ThreeGangHelperFunctions {
|
||||
String deviceId, String deviceName, functionValue) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
deviceType: '3G',
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
@@ -22,6 +23,7 @@ class ThreeGangHelperFunctions {
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceType: '3G',
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
@@ -34,6 +36,7 @@ class ThreeGangHelperFunctions {
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceType: '3G',
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
@@ -49,6 +52,7 @@ class ThreeGangHelperFunctions {
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceType: '3G',
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
@@ -61,6 +65,7 @@ class ThreeGangHelperFunctions {
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceType: '3G',
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
@@ -76,6 +81,7 @@ class ThreeGangHelperFunctions {
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceType: '3G',
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
@@ -94,6 +100,7 @@ class ThreeGangHelperFunctions {
|
||||
String deviceId, String deviceName, functionValue) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
deviceType: '3G',
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
@@ -109,6 +116,7 @@ class ThreeGangHelperFunctions {
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceType: '3G',
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
@@ -128,6 +136,7 @@ class ThreeGangHelperFunctions {
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceType: '3G',
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
@@ -143,6 +152,7 @@ class ThreeGangHelperFunctions {
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceType: '3G',
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
@@ -162,6 +172,7 @@ class ThreeGangHelperFunctions {
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceType: '3G',
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
@@ -177,6 +188,7 @@ class ThreeGangHelperFunctions {
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceType: '3G',
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
import 'package:syncrow_app/features/scene/enum/operation_dialog_type.dart';
|
||||
import 'package:syncrow_app/features/scene/model/scene_static_function.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
|
||||
class WaterHeaterFunctionsHelper {
|
||||
static List<SceneStaticFunction> waterHeaterHelperFunctions(
|
||||
String deviceId, String deviceName, functionValue) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'Reverse Switch',
|
||||
code: 'switch_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: "Power OFF",
|
||||
value: false),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: "Power ON",
|
||||
value: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'CountDown',
|
||||
code: 'countdown_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.countdown,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(icon: '', value: 0),
|
||||
],
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> waterHeaterAutomationFunctions(
|
||||
String deviceId, String deviceName, functionValue) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.refreshStatusIcon,
|
||||
operationName: 'Restart Status',
|
||||
code: 'relay_status',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.none,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: "Power OFF",
|
||||
value: 'off',
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: "Power ON",
|
||||
value: 'on',
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.refreshStatusIcon,
|
||||
description: "Restart Memory",
|
||||
value: 'memory',
|
||||
),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'Switch',
|
||||
code: 'switch_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower, description: "ON", value: true),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'CountDown',
|
||||
code: 'countdown_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.integerSteps,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
description: "sec",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 43200,
|
||||
stepValue: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsIndicator,
|
||||
operationName: 'Backlight Switch',
|
||||
code: 'switch_backlight',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower, description: "ON", value: true),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import 'package:syncrow_app/features/scene/helper/functions_per_device/one_gang_
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/presence_sensor.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/three_gang_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/tow_gang_helper_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/water_heater_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/model/scene_details_model.dart';
|
||||
import 'package:syncrow_app/features/scene/model/scene_static_function.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
@@ -29,6 +30,7 @@ mixin SceneOperationsDataHelper {
|
||||
DeviceType.Gateway: gatewayFunctions,
|
||||
DeviceType.OneGang: oneGangFunctions,
|
||||
DeviceType.TwoGang: towGangFunctions,
|
||||
DeviceType.WH: waterHeaterFunctions,
|
||||
};
|
||||
|
||||
final Map<DeviceType, String> _titleMap = {
|
||||
@@ -42,8 +44,23 @@ mixin SceneOperationsDataHelper {
|
||||
DeviceType.Gateway: 'Gateway Functions',
|
||||
DeviceType.OneGang: '1G Light Switch Conditions',
|
||||
DeviceType.TwoGang: '2G Light Switch Conditions',
|
||||
DeviceType.WH: 'Water Heater Conditions',
|
||||
};
|
||||
|
||||
static List<SceneStaticFunction> waterHeaterFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
if (isAutomation) {
|
||||
return WaterHeaterFunctionsHelper.waterHeaterAutomationFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
return WaterHeaterFunctionsHelper.waterHeaterHelperFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
//one gang functions
|
||||
static List<SceneStaticFunction> oneGangFunctions(
|
||||
List<FunctionModel> functions,
|
||||
@@ -201,6 +218,7 @@ mixin SceneOperationsDataHelper {
|
||||
if (action.entityId == 'delay') {
|
||||
functions.add(
|
||||
SceneStaticFunction(
|
||||
deviceType: action.productType,
|
||||
deviceId: action.entityId,
|
||||
deviceName: 'delay',
|
||||
deviceIcon: Assets.delay,
|
||||
@@ -222,6 +240,7 @@ mixin SceneOperationsDataHelper {
|
||||
// Handle smart scenes
|
||||
functions.add(
|
||||
SceneStaticFunction(
|
||||
deviceType: action.productType,
|
||||
deviceId: action.entityId,
|
||||
deviceName: action.name.toString(),
|
||||
deviceIcon: action.type == 'automation'
|
||||
@@ -328,6 +347,8 @@ mixin SceneOperationsDataHelper {
|
||||
'switch_alarm_sound': _createSwitchAlarmSoundFunction,
|
||||
'master_state': _createMasterStateFunction,
|
||||
'factory_reset': _createFactoryResetFunction,
|
||||
'switch_backlight': _createSwitchFunction,
|
||||
'relay_status': _relayStatusSwitchFunction,
|
||||
};
|
||||
|
||||
final functionCode = executorProperty?.functionCode ?? '';
|
||||
@@ -339,7 +360,7 @@ mixin SceneOperationsDataHelper {
|
||||
}
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSceneFunction(
|
||||
static SceneStaticFunction _createSceneFunction(
|
||||
Action action,
|
||||
String deviceName,
|
||||
String icon,
|
||||
@@ -350,8 +371,11 @@ mixin SceneOperationsDataHelper {
|
||||
String? comparator,
|
||||
String? uniqueCustomId,
|
||||
]) {
|
||||
final productType = action.productType;
|
||||
|
||||
final functionValue = action.executorProperty?.functionValue;
|
||||
return SceneStaticFunction(
|
||||
deviceType: productType,
|
||||
uniqueCustomId: uniqueCustomId,
|
||||
deviceId: action.entityId,
|
||||
deviceName: deviceName,
|
||||
@@ -422,7 +446,7 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createOnOffOptions() {
|
||||
static List<SceneOperationalValue> _createOnOffOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
@@ -744,7 +768,7 @@ mixin SceneOperationsDataHelper {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.assetsIconsAC,
|
||||
Assets.waterHeaterIcon,
|
||||
'Power',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
@@ -754,6 +778,21 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _relayStatusSwitchFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.waterHeaterIcon,
|
||||
'Restart Status',
|
||||
OperationDialogType.none,
|
||||
_createRelayStatusOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createTempSetFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
@@ -833,9 +872,22 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSwitch1Function(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
static SceneStaticFunction _createSwitch1Function(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
switch (action.productType) {
|
||||
case "WH":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.waterHeaterIcon,
|
||||
'Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
|
||||
case "3G":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
@@ -872,6 +924,30 @@ mixin SceneOperationsDataHelper {
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
case "TwoGang":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.twoGang,
|
||||
'L - Light Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
case "ThreeGang":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.twoGang,
|
||||
'L - Light Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
default:
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
@@ -914,6 +990,30 @@ mixin SceneOperationsDataHelper {
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
case "TwoGang":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.twoGang,
|
||||
'R - Light Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
case "ThreeGang":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.twoGang,
|
||||
'M - Light Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
default:
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
@@ -979,12 +1079,28 @@ mixin SceneOperationsDataHelper {
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
case "WH":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.waterHeaterIcon,
|
||||
'CountDown',
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? _createAutomationCountDownOptions()
|
||||
: _createCountdownOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
default:
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.oneGang,
|
||||
'Light CountDown',
|
||||
'CountDown',
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
@@ -1033,6 +1149,22 @@ mixin SceneOperationsDataHelper {
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
case "ThreeGang":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.twoGang,
|
||||
'R - Light CountDown',
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? _createAutomationCountDownOptions()
|
||||
: _createCountdownOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
default:
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
@@ -1395,6 +1527,7 @@ mixin SceneOperationsDataHelper {
|
||||
if (deviceId.contains('delay')) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
deviceType: taskItem.deviceType,
|
||||
uniqueCustomId: taskItem.uniqueCustomId,
|
||||
deviceId: taskItem.deviceId,
|
||||
deviceName: 'delay',
|
||||
@@ -1417,6 +1550,7 @@ mixin SceneOperationsDataHelper {
|
||||
if (taskItem.code == CreateSceneEnum.smartSceneSelect.name) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
deviceType: taskItem.deviceType,
|
||||
uniqueCustomId: taskItem.uniqueCustomId,
|
||||
deviceId: taskItem.deviceId,
|
||||
deviceName: taskItem.deviceName.toString(),
|
||||
@@ -1449,7 +1583,7 @@ mixin SceneOperationsDataHelper {
|
||||
_mapExecutorPropertyToSceneFunction(
|
||||
Action(
|
||||
deviceName: taskItem.deviceName,
|
||||
productType: '',
|
||||
productType: taskItem.deviceType!,
|
||||
entityId: deviceId,
|
||||
executorProperty: ExecutorProperty(
|
||||
functionCode: taskItem.code,
|
||||
@@ -1476,4 +1610,24 @@ mixin SceneOperationsDataHelper {
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createRelayStatusOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: "Power ON",
|
||||
value: 'on',
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: "Power OFF",
|
||||
value: 'off',
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.refreshStatusIcon,
|
||||
description: "Restart Memory",
|
||||
value: 'memory',
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ class SceneStaticFunction {
|
||||
final String? deviceIcon;
|
||||
final OperationDialogType operationDialogType;
|
||||
final String? comparator;
|
||||
final String? deviceType;
|
||||
|
||||
SceneStaticFunction({
|
||||
required this.icon,
|
||||
@@ -28,6 +29,7 @@ class SceneStaticFunction {
|
||||
this.deviceIcon,
|
||||
required this.operationDialogType,
|
||||
this.comparator,
|
||||
this.deviceType,
|
||||
String? uniqueCustomId,
|
||||
}) : uniqueCustomId = uniqueCustomId ?? const Uuid().v4();
|
||||
|
||||
@@ -44,6 +46,7 @@ class SceneStaticFunction {
|
||||
OperationDialogType? operationDialogType,
|
||||
String? comparator,
|
||||
String? uniqueCustomId,
|
||||
String? deviceType,
|
||||
}) {
|
||||
return SceneStaticFunction(
|
||||
icon: icon ?? this.icon,
|
||||
@@ -57,6 +60,7 @@ class SceneStaticFunction {
|
||||
operationDialogType: operationDialogType ?? this.operationDialogType,
|
||||
comparator: comparator ?? this.comparator,
|
||||
uniqueCustomId: uniqueCustomId ?? const Uuid().v4(),
|
||||
deviceType: deviceType ?? this.deviceType,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -73,6 +77,7 @@ class SceneStaticFunction {
|
||||
'operationDialogType': operationDialogType.name,
|
||||
'comparator': comparator,
|
||||
'uniqueCustomId': uniqueCustomId,
|
||||
'deviceType': deviceType,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -93,6 +98,7 @@ class SceneStaticFunction {
|
||||
: OperationDialogType.none,
|
||||
comparator: map['comparator'],
|
||||
uniqueCustomId: map['uniqueCustomId'] ?? const Uuid().v4(),
|
||||
deviceType: map['deviceType'] ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -103,7 +109,7 @@ class SceneStaticFunction {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SceneStaticFunction(icon: $icon, name: $deviceName, code: $code, operationalValues: $operationalValues, deviceId: $deviceId, operationName: $operationName, functionValue: $functionValue, deviceIcon: $deviceIcon, operationDialogType: $operationDialogType, comparator: $comparator, uniqueCustomId: $uniqueCustomId)';
|
||||
return 'SceneStaticFunction(icon: $icon, name: $deviceName, code: $code, operationalValues: $operationalValues, deviceId: $deviceId, operationName: $operationName, functionValue: $functionValue, deviceIcon: $deviceIcon, operationDialogType: $operationDialogType, comparator: $comparator, uniqueCustomId: $uniqueCustomId, deviceType: $deviceType)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -121,7 +127,7 @@ class SceneStaticFunction {
|
||||
other.uniqueCustomId == uniqueCustomId &&
|
||||
other.operationDialogType == operationDialogType &&
|
||||
listEquals(other.operationalValues, operationalValues) &&
|
||||
other.deviceId == deviceId;
|
||||
other.deviceId == deviceId && other.deviceType == deviceType;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -136,7 +142,7 @@ class SceneStaticFunction {
|
||||
comparator.hashCode ^
|
||||
uniqueCustomId.hashCode ^
|
||||
operationDialogType.hashCode ^
|
||||
operationalValues.hashCode;
|
||||
operationalValues.hashCode ^ deviceType.hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -257,6 +257,7 @@ class DeviceFunctionsView extends StatelessWidget
|
||||
deviceName: device.name ?? '',
|
||||
uniqueId: function.uniqueCustomId!,
|
||||
operationType: function.operationDialogType,
|
||||
deviceType: '',
|
||||
));
|
||||
Navigator.pop(context);
|
||||
},
|
||||
@@ -297,6 +298,7 @@ class DeviceFunctionsView extends StatelessWidget
|
||||
return;
|
||||
}
|
||||
context.read<CreateSceneBloc>().add(TempHoldSceneTasksEvent(
|
||||
deviceType: device.productType!.name,
|
||||
deviceControlModel: DeviceControlModel(
|
||||
deviceId: device.uuid,
|
||||
code: function.code,
|
||||
|
||||
@@ -70,7 +70,8 @@ class CustomBottomSheetWidget extends StatelessWidget {
|
||||
color: ColorsManager.greyColor,
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(context, Routes.smartAutomationSelectRoute, arguments: sceneId);
|
||||
Navigator.pushNamed(context, Routes.smartAutomationSelectRoute,
|
||||
arguments: sceneId);
|
||||
},
|
||||
),
|
||||
SceneListTile(
|
||||
@@ -92,7 +93,8 @@ class CustomBottomSheetWidget extends StatelessWidget {
|
||||
}
|
||||
|
||||
void _onDelayActionPressed(BuildContext context) {
|
||||
final functionValues = context.read<CreateSceneBloc>().selectedValues['delay'];
|
||||
final functionValues =
|
||||
context.read<CreateSceneBloc>().selectedValues['delay'];
|
||||
final functions = [
|
||||
SceneStaticFunction(
|
||||
deviceId: 'delay',
|
||||
@@ -115,8 +117,10 @@ class CustomBottomSheetWidget extends StatelessWidget {
|
||||
),
|
||||
title: functions[0].operationName,
|
||||
onConfirm: () {
|
||||
final selectedValue = context.read<CreateSceneBloc>().selectedValues['delay'];
|
||||
final selectedValue =
|
||||
context.read<CreateSceneBloc>().selectedValues['delay'];
|
||||
context.read<CreateSceneBloc>().add(TempHoldSceneTasksEvent(
|
||||
deviceType: '',
|
||||
deviceControlModel: DeviceControlModel(
|
||||
deviceId: '',
|
||||
code: '',
|
||||
@@ -138,7 +142,9 @@ class CustomBottomSheetWidget extends StatelessWidget {
|
||||
|
||||
for (var element in tempTaskList) {
|
||||
if (element.code == functions[0].code) {
|
||||
context.read<CreateSceneBloc>().add(RemoveTempTaskByIdEvent(code: functions[0].code));
|
||||
context
|
||||
.read<CreateSceneBloc>()
|
||||
.add(RemoveTempTaskByIdEvent(code: functions[0].code));
|
||||
context
|
||||
.read<CreateSceneBloc>()
|
||||
.add(RemoveFromSelectedValueById(code: functions[0].code));
|
||||
|
||||
Reference in New Issue
Block a user