mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 18:16:21 +00:00
add water heater device to routine and fix device type in routine
This commit is contained in:
12
assets/icons/refresh_status_icon.svg
Normal file
12
assets/icons/refresh_status_icon.svg
Normal file
@ -0,0 +1,12 @@
|
||||
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_7305_15779)">
|
||||
<path d="M17.0872 11.5142C17.0872 13.2025 16.427 14.8021 15.2211 15.9954C14.0278 17.2014 12.4283 17.8615 10.7399 17.8615C9.05141 17.8615 7.45185 17.2014 6.25856 15.9954C5.05262 14.8021 4.39249 13.2025 4.39249 11.5142C4.39249 9.82574 5.05266 8.22618 6.25856 7.03289C7.45185 5.8269 9.05141 5.16681 10.7399 5.16681C11.8063 5.16681 12.8471 5.43337 13.7866 5.95388L11.2984 8.97523H21.0861L18.6486 0L16.2113 2.97053C14.5737 1.91691 12.6948 1.35835 10.7398 1.35835C8.02314 1.35835 5.47142 2.41197 3.55459 4.32888C1.63765 6.24578 0.583984 8.79747 0.583984 11.5142C0.583984 14.2309 1.63765 16.7825 3.55459 18.6994C5.47146 20.6163 8.0231 21.67 10.7398 21.67C13.4565 21.67 16.0082 20.6163 17.925 18.6994C19.8419 16.7825 20.8956 14.2309 20.8956 11.5142V10.8794H17.0872V11.5142Z" fill="#77DD00"/>
|
||||
<path d="M17.0876 10.8799H20.8961V11.5146C20.8961 14.2313 19.8424 16.7829 17.9254 18.6998C16.0086 20.6168 13.4569 21.6704 10.7402 21.6704V17.862C12.4287 17.862 14.0282 17.2019 15.2215 15.9959C16.4275 14.8026 17.0876 13.203 17.0876 11.5147V10.8799H17.0876Z" fill="#66BB00"/>
|
||||
<path d="M13.787 5.95388C12.8475 5.43333 11.8066 5.16681 10.7402 5.16681V1.35835C12.6952 1.35835 14.5741 1.91691 16.2117 2.97057L18.6491 0L21.0866 8.97523H11.2989L13.787 5.95388Z" fill="#66BB00"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_7305_15779">
|
||||
<rect width="21.67" height="21.67" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
@ -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));
|
||||
|
@ -1141,10 +1141,11 @@ class Assets {
|
||||
static const String grid = 'assets/images/grid.svg';
|
||||
|
||||
static const String toggleSwitchSmall = 'assets/icons/toggleSwitchSmall.svg';
|
||||
static const String offToggleSwitchSmall = 'assets/icons/offToggleSwitchSmall.svg';
|
||||
static const String offToggleSwitchSmall =
|
||||
'assets/icons/offToggleSwitchSmall.svg';
|
||||
static const String saveRoutinesIcon = 'assets/icons/save_routines_icon.svg';
|
||||
static const String cancelIcon = 'assets/icons/cancel_icon.svg';
|
||||
|
||||
|
||||
|
||||
static const String refreshStatusIcon =
|
||||
'assets/icons/refresh_status_icon.svg';
|
||||
}
|
||||
|
Reference in New Issue
Block a user