mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 09:45:22 +00:00
Implement Flush Mounted Presence Sensor Routine Control and change the device type logic
This commit is contained in:
@ -4,6 +4,7 @@ import 'package:syncrow_app/features/scene/enum/create_scene_enum.dart';
|
||||
import 'package:syncrow_app/features/scene/enum/operation_dialog_type.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/ac_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/door_lock_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/flush_functions_helper.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/gateway_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/human_presence_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/one_gang_functions.dart';
|
||||
@ -18,7 +19,7 @@ import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
|
||||
mixin SceneOperationsDataHelper {
|
||||
final Map<DeviceType,
|
||||
Function(List<FunctionModel>, String, String, dynamic, bool)>
|
||||
Function(List<FunctionModel>, String, String, dynamic, bool, String)>
|
||||
_functionMap = {
|
||||
DeviceType.LightBulb: lightBulbFunctions,
|
||||
DeviceType.CeilingSensor: ceilingSensorFunctions,
|
||||
@ -31,6 +32,7 @@ mixin SceneOperationsDataHelper {
|
||||
DeviceType.OneGang: oneGangFunctions,
|
||||
DeviceType.TwoGang: towGangFunctions,
|
||||
DeviceType.WH: waterHeaterFunctions,
|
||||
DeviceType.FlushMountedSensor: flushFunctions
|
||||
};
|
||||
|
||||
final Map<DeviceType, String> _titleMap = {
|
||||
@ -45,14 +47,33 @@ mixin SceneOperationsDataHelper {
|
||||
DeviceType.OneGang: '1G Light Switch Conditions',
|
||||
DeviceType.TwoGang: '2G Light Switch Conditions',
|
||||
DeviceType.WH: 'Water Heater Conditions',
|
||||
DeviceType.FlushMountedSensor: 'Flush Presence Sensor Functions'
|
||||
};
|
||||
|
||||
static List<SceneStaticFunction> flushFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation,
|
||||
String productType,
|
||||
) {
|
||||
if (isAutomation) {
|
||||
return FlushFunctionsHelper.flushSceneHelperFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
return FlushFunctionsHelper.flushAutomationFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> waterHeaterFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation,
|
||||
String productType,
|
||||
) {
|
||||
if (isAutomation) {
|
||||
return WaterHeaterFunctionsHelper.waterHeaterAutomationFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
@ -63,11 +84,13 @@ mixin SceneOperationsDataHelper {
|
||||
|
||||
//one gang functions
|
||||
static List<SceneStaticFunction> oneGangFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation,
|
||||
String productType,
|
||||
) {
|
||||
if (isAutomation) {
|
||||
return OneGangHelperFunctions.oneGangAutomationFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
@ -77,11 +100,13 @@ mixin SceneOperationsDataHelper {
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> towGangFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation,
|
||||
String productType,
|
||||
) {
|
||||
if (isAutomation) {
|
||||
return TowGangHelperFunctions.towGangAutomationFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
@ -95,13 +120,14 @@ mixin SceneOperationsDataHelper {
|
||||
required List<FunctionModel> functions,
|
||||
required String deviceId,
|
||||
required String deviceName,
|
||||
required String productType,
|
||||
required bool isAutomation,
|
||||
}) {
|
||||
final functionValue = null;
|
||||
return _functionMap[type]?.call(
|
||||
functions, deviceId, deviceName, functionValue, isAutomation) ??
|
||||
lightBulbFunctions(
|
||||
functions, deviceId, deviceName, functionValue, isAutomation);
|
||||
return _functionMap[type]?.call(functions, deviceId, deviceName,
|
||||
functionValue, isAutomation, productType) ??
|
||||
lightBulbFunctions(functions, deviceId, deviceName, functionValue,
|
||||
isAutomation, productType);
|
||||
}
|
||||
|
||||
String getTitle({DeviceType? type}) {
|
||||
@ -109,11 +135,13 @@ mixin SceneOperationsDataHelper {
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> ceilingSensorFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation,
|
||||
String productType,
|
||||
) {
|
||||
if (isAutomation) {
|
||||
return PresenceSensorHelperFunctions.automationPresenceSensorFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
@ -123,20 +151,24 @@ mixin SceneOperationsDataHelper {
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> curtainFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation,
|
||||
String productType,
|
||||
) {
|
||||
return [];
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> doorLockFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation,
|
||||
String productType,
|
||||
) {
|
||||
if (isAutomation) {
|
||||
return DoorLockHelperFunctions.doorLockAutomationFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
@ -146,11 +178,13 @@ mixin SceneOperationsDataHelper {
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> wallSensorFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation,
|
||||
String productType,
|
||||
) {
|
||||
if (isAutomation) {
|
||||
return HumanPresenceHelperFunctions.automationHumanPresenceFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
@ -164,26 +198,31 @@ mixin SceneOperationsDataHelper {
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
bool isAutomation,
|
||||
String productType) {
|
||||
return [];
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> gatewayFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation,
|
||||
String productType,
|
||||
) {
|
||||
return GatewayHelperFunctions.tabToRunGatewayFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> threeGangFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation,
|
||||
String productType,
|
||||
) {
|
||||
if (isAutomation) {
|
||||
return ThreeGangHelperFunctions.threeGangAutomationFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
@ -193,11 +232,13 @@ mixin SceneOperationsDataHelper {
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> acFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation,
|
||||
String productType,
|
||||
) {
|
||||
if (isAutomation) {
|
||||
return ACFunctionsHelper.automationAcFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
@ -212,7 +253,19 @@ mixin SceneOperationsDataHelper {
|
||||
List<Condition>? conditions,
|
||||
}) {
|
||||
List<SceneStaticFunction> functions = [];
|
||||
|
||||
for (var action in 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Handle actions
|
||||
for (var action in actions) {
|
||||
if (action.entityId == 'delay') {
|
||||
@ -306,11 +359,9 @@ mixin SceneOperationsDataHelper {
|
||||
String? uniqueCustomId,
|
||||
}) {
|
||||
final executorProperty = action.executorProperty;
|
||||
|
||||
final Map<String,
|
||||
SceneStaticFunction Function(Action, bool, String?, String?)>
|
||||
functionMap = {
|
||||
'sensitivity': _createSensitivityFunction,
|
||||
'normal_open_switch': _createNormalOpenSwitchFunction,
|
||||
'unlock_fingerprint': _createUnlockFingerprintFunction,
|
||||
'unlock_password': _createUnlockPasswordFunction,
|
||||
@ -323,12 +374,21 @@ mixin SceneOperationsDataHelper {
|
||||
'hijack': _createHijackFunction,
|
||||
'doorbell': _createDoorbellFunction,
|
||||
'unlock_temporary': _createUnlockTemporaryFunction,
|
||||
'far_detection': _createFarDetectionFunction,
|
||||
'near_detection': _createNearDetectionOptions,
|
||||
if (action.productType == 'NCPS') ...{
|
||||
'far_detection': _createFarDetectionOptionsFlush,
|
||||
'presence_state': _createPresenceStateFunctionFlush,
|
||||
'illum_value': _createIlluminanceValueFunctionFlush,
|
||||
'sensitivity': _createSensitivityFunctionFlush,
|
||||
} else ...{
|
||||
'far_detection': _createFarDetectionFunction,
|
||||
'presence_state': _createPresenceStateFunction,
|
||||
'sensitivity': _createSensitivityFunction,
|
||||
},
|
||||
'motion_sensitivity_value': _createMotionSensitivityFunction,
|
||||
'motionless_sensitivity': _createMotionlessSensitivityFunction,
|
||||
'indicator': _createIndicatorFunction,
|
||||
'presence_time': _createPresenceTimeFunction,
|
||||
'presence_state': _createPresenceStateFunction,
|
||||
'dis_current': _createDisCurrentFunction,
|
||||
'illuminance_value': _createIlluminanceValueFunction,
|
||||
'checking_result': _createCheckingResultFunction,
|
||||
@ -349,6 +409,10 @@ mixin SceneOperationsDataHelper {
|
||||
'factory_reset': _createFactoryResetFunction,
|
||||
'switch_backlight': _createSwitchFunction,
|
||||
'relay_status': _relayStatusSwitchFunction,
|
||||
'sensi_reduce': _createTriggerLevelOptions,
|
||||
'occur_dist_reduce': _createIndentLevelOptions,
|
||||
'presence_delay': _createTargetConfirmTime,
|
||||
'none_delay': _createDisappeDelay
|
||||
};
|
||||
|
||||
final functionCode = executorProperty?.functionCode ?? '';
|
||||
@ -372,7 +436,6 @@ mixin SceneOperationsDataHelper {
|
||||
String? uniqueCustomId,
|
||||
]) {
|
||||
final productType = action.productType;
|
||||
|
||||
final functionValue = action.executorProperty?.functionValue;
|
||||
return SceneStaticFunction(
|
||||
deviceType: productType,
|
||||
@ -765,17 +828,36 @@ mixin SceneOperationsDataHelper {
|
||||
|
||||
SceneStaticFunction _createSwitchFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.waterHeaterIcon,
|
||||
'Power',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
switch (action.productType) {
|
||||
case "AC":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.assetsIconsAC,
|
||||
'Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
|
||||
case "WH":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.waterHeaterIcon,
|
||||
'Power',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
|
||||
default:
|
||||
throw ArgumentError('Unsupported product type: ${action.productType}');
|
||||
}
|
||||
}
|
||||
|
||||
SceneStaticFunction _relayStatusSwitchFunction(Action action,
|
||||
@ -875,6 +957,19 @@ mixin SceneOperationsDataHelper {
|
||||
static SceneStaticFunction _createSwitch1Function(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
switch (action.productType) {
|
||||
case "AC":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.acSwitchIcon,
|
||||
'Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
|
||||
case "WH":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
@ -1349,6 +1444,21 @@ mixin SceneOperationsDataHelper {
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createPresenceStateOptionsFlush() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsIconsPresenceSensorAssetsEmpty,
|
||||
value: 'none',
|
||||
description: 'None',
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsPresence,
|
||||
value: 'presence',
|
||||
description: 'Presence',
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createPresenceStateOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
@ -1582,7 +1692,7 @@ mixin SceneOperationsDataHelper {
|
||||
return [
|
||||
_mapExecutorPropertyToSceneFunction(
|
||||
Action(
|
||||
deviceName: taskItem.deviceName,
|
||||
deviceName: taskItem.deviceName!,
|
||||
productType: taskItem.deviceType!,
|
||||
entityId: deviceId,
|
||||
executorProperty: ExecutorProperty(
|
||||
@ -1630,4 +1740,296 @@ mixin SceneOperationsDataHelper {
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
SceneStaticFunction _createNearDetectionOptions(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.flushIcon,
|
||||
'Min Detection distance',
|
||||
OperationDialogType.integerSteps,
|
||||
_createMinDetection(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createFarDetectionOptionsFlush(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.flushIcon,
|
||||
'Max Detection distance',
|
||||
OperationDialogType.integerSteps,
|
||||
_createFarDetection(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createTriggerLevelOptions(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.flushIcon,
|
||||
"Trigger Level",
|
||||
OperationDialogType.listOfOptions,
|
||||
_createTriggerLevelFunction(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createTriggerLevelFunction() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
description: "1",
|
||||
value: 1,
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
description: "2",
|
||||
value: 2,
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
description: "3",
|
||||
value: 3,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
SceneStaticFunction _createIndentLevelOptions(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.flushIcon,
|
||||
'Indent Level',
|
||||
OperationDialogType.listOfOptions,
|
||||
_createIndentLevelFunction(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createIndentLevelFunction() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
description: "1",
|
||||
value: 1,
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
description: "2",
|
||||
value: 2,
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
description: "3",
|
||||
value: 3,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
SceneStaticFunction _createTargetConfirmTime(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.flushIcon,
|
||||
'Target Confirm Time',
|
||||
OperationDialogType.integerSteps,
|
||||
_targetConfirmTimeFun(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createDisappeDelay(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.flushIcon,
|
||||
'Disappe Delay',
|
||||
OperationDialogType.integerSteps,
|
||||
_targetDisappeDelayFun(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _targetDisappeDelayFun() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.flushIcon,
|
||||
value: 0.0,
|
||||
description: '',
|
||||
minValue: 20,
|
||||
maxValue: 300,
|
||||
stepValue: 1,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createFarDetection() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
description: "m",
|
||||
value: 0.0,
|
||||
minValue: 0.0,
|
||||
maxValue: 9.5,
|
||||
stepValue: 1,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createMinDetection() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
description: "m",
|
||||
value: 0.0,
|
||||
minValue: 0.0,
|
||||
maxValue: 9.5,
|
||||
stepValue: 1,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _targetConfirmTimeFun() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsCelsiusDegrees,
|
||||
value: 0.0,
|
||||
description: '',
|
||||
minValue: 0.0,
|
||||
maxValue: 0.5,
|
||||
stepValue: 0.1,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
SceneStaticFunction _createPresenceStateFunctionFlush(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.flushIcon,
|
||||
'Presence State',
|
||||
OperationDialogType.listOfOptions,
|
||||
_createPresenceStateOptionsFlush(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createIlluminanceValueFunctionFlush(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.flushIcon,
|
||||
'Illuminance Value',
|
||||
OperationDialogType.integerSteps,
|
||||
_createIlluminanceValueOptionsFlush(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createIlluminanceValueOptionsFlush() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
value: 0.0,
|
||||
description: "Lux",
|
||||
minValue: 0,
|
||||
maxValue: 10000,
|
||||
stepValue: 1,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSensitivityFunctionFlush(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.flushIcon,
|
||||
'Sensitivity',
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.listOfOptions,
|
||||
_createIntegerStepsOptionsFlush(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createIntegerStepsOptionsFlush() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
value: 1,
|
||||
description: 1.toString(),
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
value: 2,
|
||||
description: 2.toString(),
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
value: 3,
|
||||
description: 3.toString(),
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
value: 4,
|
||||
description: 4.toString(),
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
value: 5,
|
||||
description: 5.toString(),
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
value: 6,
|
||||
description: 6.toString(),
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
value: 7,
|
||||
description: 7.toString(),
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
value: 8,
|
||||
description: 8.toString(),
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
value: 9,
|
||||
description: 9.toString(),
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user