mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
@ -37,12 +37,12 @@ class SwitchFunction extends ACFunction {
|
||||
List<ACOperationalValue> getOperationalValues() => [
|
||||
ACOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: 'ON',
|
||||
description: "ON",
|
||||
value: true,
|
||||
),
|
||||
ACOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: 'OFF',
|
||||
description: "OFF",
|
||||
value: false,
|
||||
),
|
||||
];
|
||||
@ -62,17 +62,17 @@ class ModeFunction extends ACFunction {
|
||||
List<ACOperationalValue> getOperationalValues() => [
|
||||
ACOperationalValue(
|
||||
icon: Assets.assetsAcCooling,
|
||||
description: 'Cooling',
|
||||
description: "Cooling",
|
||||
value: TempModes.cold.name,
|
||||
),
|
||||
ACOperationalValue(
|
||||
icon: Assets.assetsAcHeating,
|
||||
description: 'Heating',
|
||||
description: "Heating",
|
||||
value: TempModes.hot.name,
|
||||
),
|
||||
ACOperationalValue(
|
||||
icon: Assets.assetsFanSpeed,
|
||||
description: 'Ventilation',
|
||||
description: "Ventilation",
|
||||
value: TempModes.wind.name,
|
||||
),
|
||||
];
|
||||
@ -90,23 +90,22 @@ class TempSetFunction extends ACFunction {
|
||||
min: 200,
|
||||
max: 300,
|
||||
step: 1,
|
||||
unit: '°C',
|
||||
unit: "°C",
|
||||
);
|
||||
|
||||
@override
|
||||
List<ACOperationalValue> getOperationalValues() {
|
||||
final values = <ACOperationalValue>[];
|
||||
for (var temp = min!.toInt(); temp <= max!; temp += step!.toInt()) {
|
||||
List<ACOperationalValue> values = [];
|
||||
for (int temp = min!.toInt(); temp <= max!; temp += step!.toInt()) {
|
||||
values.add(ACOperationalValue(
|
||||
icon: Assets.assetsTempreture,
|
||||
description: '${temp / 10}°C',
|
||||
description: "${temp / 10}°C",
|
||||
value: temp,
|
||||
));
|
||||
}
|
||||
return values;
|
||||
}
|
||||
}
|
||||
|
||||
class LevelFunction extends ACFunction {
|
||||
LevelFunction(
|
||||
{required super.deviceId, required super.deviceName, required type})
|
||||
@ -121,22 +120,22 @@ class LevelFunction extends ACFunction {
|
||||
List<ACOperationalValue> getOperationalValues() => [
|
||||
ACOperationalValue(
|
||||
icon: Assets.assetsAcFanLow,
|
||||
description: 'LOW',
|
||||
description: "LOW",
|
||||
value: FanSpeeds.low.name,
|
||||
),
|
||||
ACOperationalValue(
|
||||
icon: Assets.assetsAcFanMiddle,
|
||||
description: 'MIDDLE',
|
||||
description: "MIDDLE",
|
||||
value: FanSpeeds.middle.name,
|
||||
),
|
||||
ACOperationalValue(
|
||||
icon: Assets.assetsAcFanHigh,
|
||||
description: 'HIGH',
|
||||
description: "HIGH",
|
||||
value: FanSpeeds.high.name,
|
||||
),
|
||||
ACOperationalValue(
|
||||
icon: Assets.assetsAcFanAuto,
|
||||
description: 'AUTO',
|
||||
description: "AUTO",
|
||||
value: FanSpeeds.auto.name,
|
||||
),
|
||||
];
|
||||
@ -156,26 +155,22 @@ class ChildLockFunction extends ACFunction {
|
||||
List<ACOperationalValue> getOperationalValues() => [
|
||||
ACOperationalValue(
|
||||
icon: Assets.assetsSceneChildLock,
|
||||
description: 'Lock',
|
||||
description: "Lock",
|
||||
value: true,
|
||||
),
|
||||
ACOperationalValue(
|
||||
icon: Assets.assetsSceneChildUnlock,
|
||||
description: 'Unlock',
|
||||
description: "Unlock",
|
||||
value: false,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
class CurrentTempFunction extends ACFunction {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
@override
|
||||
final String unit = '°C';
|
||||
final String unit = "°C";
|
||||
|
||||
CurrentTempFunction(
|
||||
{required super.deviceId, required super.deviceName, required type})
|
||||
@ -191,11 +186,11 @@ class CurrentTempFunction extends ACFunction {
|
||||
|
||||
@override
|
||||
List<ACOperationalValue> getOperationalValues() {
|
||||
final values = <ACOperationalValue>[];
|
||||
for (var temp = min.toInt(); temp <= max; temp += step.toInt()) {
|
||||
List<ACOperationalValue> values = [];
|
||||
for (int temp = min.toInt(); temp <= max; temp += step.toInt()) {
|
||||
values.add(ACOperationalValue(
|
||||
icon: Assets.currentTemp,
|
||||
description: '${temp / 10}°C',
|
||||
description: "${temp / 10}°C",
|
||||
value: temp,
|
||||
));
|
||||
}
|
||||
|
@ -6,10 +6,12 @@ class CpsOperationalValue {
|
||||
final String description;
|
||||
final dynamic value;
|
||||
|
||||
|
||||
CpsOperationalValue({
|
||||
required this.icon,
|
||||
required this.description,
|
||||
required this.value,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@ -43,12 +45,12 @@ final class CpsRadarSwitchFunction extends CpsFunctions {
|
||||
List<CpsOperationalValue> getOperationalValues() => [
|
||||
CpsOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: 'ON',
|
||||
description: "ON",
|
||||
value: true,
|
||||
),
|
||||
CpsOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: 'OFF',
|
||||
description: "OFF",
|
||||
value: false,
|
||||
),
|
||||
];
|
||||
@ -69,12 +71,12 @@ final class CpsSpatialParameterSwitchFunction extends CpsFunctions {
|
||||
List<CpsOperationalValue> getOperationalValues() => [
|
||||
CpsOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: 'ON',
|
||||
description: "ON",
|
||||
value: true,
|
||||
),
|
||||
CpsOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: 'OFF',
|
||||
description: "OFF",
|
||||
value: false,
|
||||
),
|
||||
];
|
||||
@ -94,11 +96,8 @@ final class CpsSensitivityFunction extends CpsFunctions {
|
||||
icon: Assets.sensitivity,
|
||||
);
|
||||
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
static const _images = <String>[
|
||||
@ -145,11 +144,8 @@ final class CpsMovingSpeedFunction extends CpsFunctions {
|
||||
icon: Assets.speedoMeter,
|
||||
);
|
||||
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
@override
|
||||
@ -179,11 +175,8 @@ final class CpsSpatialStaticValueFunction extends CpsFunctions {
|
||||
icon: Assets.spatialStaticValue,
|
||||
);
|
||||
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
@override
|
||||
@ -213,11 +206,8 @@ final class CpsSpatialMotionValueFunction extends CpsFunctions {
|
||||
icon: Assets.spatialMotionValue,
|
||||
);
|
||||
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
@override
|
||||
@ -247,11 +237,8 @@ final class CpsMaxDistanceOfDetectionFunction extends CpsFunctions {
|
||||
icon: Assets.currentDistanceIcon,
|
||||
);
|
||||
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
@override
|
||||
@ -260,7 +247,7 @@ final class CpsMaxDistanceOfDetectionFunction extends CpsFunctions {
|
||||
return List.generate(
|
||||
count,
|
||||
(index) {
|
||||
final value = min + (index * step);
|
||||
final value = (min + (index * step));
|
||||
return CpsOperationalValue(
|
||||
icon: Assets.currentDistanceIcon,
|
||||
description: '${value.toStringAsFixed(1)} M',
|
||||
@ -285,11 +272,8 @@ final class CpsMaxDistanceOfStaticDetectionFunction extends CpsFunctions {
|
||||
icon: Assets.currentDistanceIcon,
|
||||
);
|
||||
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
@override
|
||||
@ -298,7 +282,7 @@ final class CpsMaxDistanceOfStaticDetectionFunction extends CpsFunctions {
|
||||
return List.generate(
|
||||
count,
|
||||
(index) {
|
||||
final value = min + (index * step);
|
||||
final value = (min + (index * step));
|
||||
return CpsOperationalValue(
|
||||
icon: Assets.currentDistanceIcon,
|
||||
description: '${value.toStringAsFixed(1)} M',
|
||||
@ -323,11 +307,8 @@ final class CpsDetectionRangeFunction extends CpsFunctions {
|
||||
icon: Assets.farDetection,
|
||||
);
|
||||
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
@override
|
||||
@ -336,7 +317,7 @@ final class CpsDetectionRangeFunction extends CpsFunctions {
|
||||
return List.generate(
|
||||
count,
|
||||
(index) {
|
||||
final value = min + (index * step);
|
||||
final value = (min + (index * step));
|
||||
return CpsOperationalValue(
|
||||
icon: Assets.farDetection,
|
||||
description: '${value.toStringAsFixed(1)} M',
|
||||
@ -361,11 +342,8 @@ final class CpsDistanceOfMovingObjectsFunction extends CpsFunctions {
|
||||
icon: Assets.currentDistanceIcon,
|
||||
);
|
||||
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
@override
|
||||
@ -374,7 +352,7 @@ final class CpsDistanceOfMovingObjectsFunction extends CpsFunctions {
|
||||
return List.generate(
|
||||
count,
|
||||
(index) {
|
||||
final value = min + (index * step);
|
||||
final value = (min + (index * step));
|
||||
return CpsOperationalValue(
|
||||
icon: Assets.currentDistanceIcon,
|
||||
description: '${value.toStringAsFixed(1)} M',
|
||||
@ -399,11 +377,8 @@ final class CpsPresenceJudgementThrsholdFunction extends CpsFunctions {
|
||||
icon: Assets.presenceJudgementThrshold,
|
||||
);
|
||||
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
@override
|
||||
@ -433,11 +408,8 @@ final class CpsMotionAmplitudeTriggerThresholdFunction extends CpsFunctions {
|
||||
icon: Assets.presenceJudgementThrshold,
|
||||
);
|
||||
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
@override
|
||||
@ -467,11 +439,8 @@ final class CpsPerpetualBoundaryFunction extends CpsFunctions {
|
||||
icon: Assets.boundary,
|
||||
);
|
||||
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
@override
|
||||
@ -480,7 +449,7 @@ final class CpsPerpetualBoundaryFunction extends CpsFunctions {
|
||||
return List.generate(
|
||||
count,
|
||||
(index) {
|
||||
final value = min + (index * step);
|
||||
final value = (min + (index * step));
|
||||
return CpsOperationalValue(
|
||||
icon: Assets.boundary,
|
||||
description: '${value.toStringAsFixed(1)}M',
|
||||
@ -505,11 +474,8 @@ final class CpsMotionTriggerBoundaryFunction extends CpsFunctions {
|
||||
icon: Assets.motionMeter,
|
||||
);
|
||||
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
@override
|
||||
@ -518,7 +484,7 @@ final class CpsMotionTriggerBoundaryFunction extends CpsFunctions {
|
||||
return List.generate(
|
||||
count,
|
||||
(index) {
|
||||
final value = min + (index * step);
|
||||
final value = (min + (index * step));
|
||||
return CpsOperationalValue(
|
||||
icon: Assets.motionMeter,
|
||||
description: '${value.toStringAsFixed(1)} M',
|
||||
@ -543,11 +509,8 @@ final class CpsMotionTriggerTimeFunction extends CpsFunctions {
|
||||
icon: Assets.motionMeter,
|
||||
);
|
||||
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
@override
|
||||
@ -556,7 +519,7 @@ final class CpsMotionTriggerTimeFunction extends CpsFunctions {
|
||||
return List.generate(
|
||||
count,
|
||||
(index) {
|
||||
final value = min + (index * step);
|
||||
final value = (min + (index * step));
|
||||
return CpsOperationalValue(
|
||||
icon: Assets.motionMeter,
|
||||
description: '${value.toStringAsFixed(3)} sec',
|
||||
@ -581,11 +544,8 @@ final class CpsMotionToStaticTimeFunction extends CpsFunctions {
|
||||
icon: Assets.motionMeter,
|
||||
);
|
||||
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
@override
|
||||
@ -594,7 +554,7 @@ final class CpsMotionToStaticTimeFunction extends CpsFunctions {
|
||||
return List.generate(
|
||||
count,
|
||||
(index) {
|
||||
final value = min + (index * step);
|
||||
final value = (min + (index * step));
|
||||
return CpsOperationalValue(
|
||||
icon: Assets.motionMeter,
|
||||
description: '${value.toStringAsFixed(0)} sec',
|
||||
@ -619,11 +579,8 @@ final class CpsEnteringNoBodyStateTimeFunction extends CpsFunctions {
|
||||
icon: Assets.motionMeter,
|
||||
);
|
||||
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
@override
|
||||
@ -632,7 +589,7 @@ final class CpsEnteringNoBodyStateTimeFunction extends CpsFunctions {
|
||||
return List.generate(
|
||||
count,
|
||||
(index) {
|
||||
final value = min + (index * step);
|
||||
final value = (min + (index * step));
|
||||
return CpsOperationalValue(
|
||||
icon: Assets.motionMeter,
|
||||
description: '${value.toStringAsFixed(0)} sec',
|
||||
@ -912,11 +869,8 @@ final class CpsSportsParaFunction extends CpsFunctions {
|
||||
icon: Assets.sportsPara,
|
||||
);
|
||||
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
@override
|
||||
@ -925,7 +879,7 @@ final class CpsSportsParaFunction extends CpsFunctions {
|
||||
return List.generate(
|
||||
count,
|
||||
(index) {
|
||||
final value = min + (index * step);
|
||||
final value = (min + (index * step));
|
||||
return CpsOperationalValue(
|
||||
icon: Assets.motionMeter,
|
||||
description: value.toStringAsFixed(0),
|
||||
|
@ -112,7 +112,7 @@ class CreateSceneAction {
|
||||
CreateSceneExecutorProperty? executorProperty,
|
||||
}) {
|
||||
return CreateSceneAction(
|
||||
actionType: actionType ?? actionType,
|
||||
actionType: actionType ?? this.actionType,
|
||||
entityId: entityId ?? this.entityId,
|
||||
actionExecutor: actionExecutor ?? this.actionExecutor,
|
||||
executorProperty: executorProperty ?? this.executorProperty,
|
||||
@ -128,7 +128,7 @@ class CreateSceneAction {
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'actionType': actionType,
|
||||
"actionType": actionType,
|
||||
'entityId': entityId,
|
||||
'actionExecutor': actionExecutor,
|
||||
};
|
||||
|
@ -14,7 +14,7 @@ class DelayFunction extends BaseSwitchFunction {
|
||||
List<SwitchOperationalValue> getOperationalValues() => [
|
||||
SwitchOperationalValue(
|
||||
icon: '',
|
||||
description: 'Duration in seconds',
|
||||
description: "Duration in seconds",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 43200,
|
||||
|
@ -24,7 +24,8 @@ class FlushPresenceDelayFunction extends FlushFunctions {
|
||||
required super.deviceId,
|
||||
required super.deviceName,
|
||||
required super.type,
|
||||
}) : super(
|
||||
}) :
|
||||
super(
|
||||
code: FlushMountedPresenceSensorModel.codePresenceState,
|
||||
operationName: 'Presence State',
|
||||
icon: Assets.presenceStateIcon,
|
||||
@ -36,7 +37,7 @@ class FlushPresenceDelayFunction extends FlushFunctions {
|
||||
FlushOperationalValue(
|
||||
icon: Assets.nobodyTime,
|
||||
description: 'None',
|
||||
value: 'none',
|
||||
value: "none",
|
||||
),
|
||||
FlushOperationalValue(
|
||||
icon: Assets.presenceStateIcon,
|
||||
@ -48,11 +49,8 @@ class FlushPresenceDelayFunction extends FlushFunctions {
|
||||
}
|
||||
|
||||
class FlushSensiReduceFunction extends FlushFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
FlushSensiReduceFunction({
|
||||
@ -81,11 +79,8 @@ class FlushSensiReduceFunction extends FlushFunctions {
|
||||
}
|
||||
|
||||
class FlushNoneDelayFunction extends FlushFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final String unit;
|
||||
|
||||
FlushNoneDelayFunction({
|
||||
@ -114,11 +109,8 @@ class FlushNoneDelayFunction extends FlushFunctions {
|
||||
}
|
||||
|
||||
class FlushIlluminanceFunction extends FlushFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
FlushIlluminanceFunction({
|
||||
@ -136,11 +128,11 @@ class FlushIlluminanceFunction extends FlushFunctions {
|
||||
|
||||
@override
|
||||
List<FlushOperationalValue> getOperationalValues() {
|
||||
final values = <FlushOperationalValue>[];
|
||||
for (var lux = min.toInt(); lux <= max; lux += step.toInt()) {
|
||||
List<FlushOperationalValue> values = [];
|
||||
for (int lux = min.toInt(); lux <= max; lux += step.toInt()) {
|
||||
values.add(FlushOperationalValue(
|
||||
icon: Assets.IlluminanceIcon,
|
||||
description: '$lux Lux',
|
||||
description: "$lux Lux",
|
||||
value: lux,
|
||||
));
|
||||
}
|
||||
@ -149,11 +141,8 @@ class FlushIlluminanceFunction extends FlushFunctions {
|
||||
}
|
||||
|
||||
class FlushOccurDistReduceFunction extends FlushFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
FlushOccurDistReduceFunction({
|
||||
@ -183,11 +172,8 @@ class FlushOccurDistReduceFunction extends FlushFunctions {
|
||||
|
||||
// ==== then functions ====
|
||||
class FlushSensitivityFunction extends FlushFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
FlushSensitivityFunction({
|
||||
@ -216,13 +202,9 @@ class FlushSensitivityFunction extends FlushFunctions {
|
||||
}
|
||||
|
||||
class FlushNearDetectionFunction extends FlushFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
@override
|
||||
final String unit;
|
||||
|
||||
FlushNearDetectionFunction({
|
||||
@ -242,7 +224,7 @@ class FlushNearDetectionFunction extends FlushFunctions {
|
||||
@override
|
||||
List<FlushOperationalValue> getOperationalValues() {
|
||||
final values = <FlushOperationalValue>[];
|
||||
for (var value = min; value <= max; value += step) {
|
||||
for (var value = min.toDouble(); value <= max; value += step) {
|
||||
values.add(FlushOperationalValue(
|
||||
icon: Assets.nobodyTime,
|
||||
description: '$value $unit',
|
||||
@ -254,13 +236,9 @@ class FlushNearDetectionFunction extends FlushFunctions {
|
||||
}
|
||||
|
||||
class FlushMaxDetectDistFunction extends FlushFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
@override
|
||||
final String unit;
|
||||
|
||||
FlushMaxDetectDistFunction({
|
||||
@ -292,13 +270,9 @@ class FlushMaxDetectDistFunction extends FlushFunctions {
|
||||
}
|
||||
|
||||
class FlushTargetConfirmTimeFunction extends FlushFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
@override
|
||||
final String unit;
|
||||
|
||||
FlushTargetConfirmTimeFunction({
|
||||
@ -318,7 +292,7 @@ class FlushTargetConfirmTimeFunction extends FlushFunctions {
|
||||
@override
|
||||
List<FlushOperationalValue> getOperationalValues() {
|
||||
final values = <FlushOperationalValue>[];
|
||||
for (var value = min; value <= max; value += step) {
|
||||
for (var value = min.toDouble(); value <= max; value += step) {
|
||||
values.add(FlushOperationalValue(
|
||||
icon: Assets.nobodyTime,
|
||||
description: '$value $unit',
|
||||
@ -330,13 +304,9 @@ class FlushTargetConfirmTimeFunction extends FlushFunctions {
|
||||
}
|
||||
|
||||
class FlushDisappeDelayFunction extends FlushFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
@override
|
||||
final String unit;
|
||||
|
||||
FlushDisappeDelayFunction({
|
||||
@ -356,7 +326,7 @@ class FlushDisappeDelayFunction extends FlushFunctions {
|
||||
@override
|
||||
List<FlushOperationalValue> getOperationalValues() {
|
||||
final values = <FlushOperationalValue>[];
|
||||
for (var value = min; value <= max; value += step) {
|
||||
for (var value = min.toDouble(); value <= max; value += step) {
|
||||
values.add(FlushOperationalValue(
|
||||
icon: Assets.nobodyTime,
|
||||
description: '$value $unit',
|
||||
@ -368,13 +338,9 @@ class FlushDisappeDelayFunction extends FlushFunctions {
|
||||
}
|
||||
|
||||
class FlushIndentLevelFunction extends FlushFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
@override
|
||||
final String unit;
|
||||
|
||||
FlushIndentLevelFunction({
|
||||
@ -394,7 +360,7 @@ class FlushIndentLevelFunction extends FlushFunctions {
|
||||
@override
|
||||
List<FlushOperationalValue> getOperationalValues() {
|
||||
final values = <FlushOperationalValue>[];
|
||||
for (var value = min; value <= max; value += step) {
|
||||
for (var value = min.toDouble(); value <= max; value += step) {
|
||||
values.add(FlushOperationalValue(
|
||||
icon: Assets.nobodyTime,
|
||||
description: '$value $unit',
|
||||
@ -406,13 +372,9 @@ class FlushIndentLevelFunction extends FlushFunctions {
|
||||
}
|
||||
|
||||
class FlushTriggerLevelFunction extends FlushFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
@override
|
||||
final String unit;
|
||||
|
||||
FlushTriggerLevelFunction({
|
||||
@ -432,7 +394,7 @@ class FlushTriggerLevelFunction extends FlushFunctions {
|
||||
@override
|
||||
List<FlushOperationalValue> getOperationalValues() {
|
||||
final values = <FlushOperationalValue>[];
|
||||
for (var value = min; value <= max; value += step) {
|
||||
for (var value = min.toDouble(); value <= max; value += step) {
|
||||
values.add(FlushOperationalValue(
|
||||
icon: Assets.nobodyTime,
|
||||
description: '$value $unit',
|
||||
|
@ -14,12 +14,12 @@ class OneGangSwitchFunction extends BaseSwitchFunction {
|
||||
List<SwitchOperationalValue> getOperationalValues() => [
|
||||
SwitchOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: 'ON',
|
||||
description: "ON",
|
||||
value: true,
|
||||
),
|
||||
SwitchOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: 'OFF',
|
||||
description: "OFF",
|
||||
value: false,
|
||||
),
|
||||
];
|
||||
@ -37,7 +37,7 @@ class OneGangCountdownFunction extends BaseSwitchFunction {
|
||||
List<SwitchOperationalValue> getOperationalValues() => [
|
||||
SwitchOperationalValue(
|
||||
icon: '',
|
||||
description: 'sec',
|
||||
description: "sec",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 43200,
|
||||
|
@ -3,11 +3,8 @@ import 'package:syncrow_web/pages/routines/models/gang_switches/switch_operation
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
|
||||
class ThreeGangSwitch1Function extends BaseSwitchFunction {
|
||||
ThreeGangSwitch1Function({
|
||||
required super.deviceId,
|
||||
required super.deviceName,
|
||||
required String type,
|
||||
}) : super(
|
||||
ThreeGangSwitch1Function({required super.deviceId, required super.deviceName ,required type})
|
||||
: super(
|
||||
code: 'switch_1',
|
||||
operationName: 'Light 1 Switch',
|
||||
icon: Assets.assetsAcPower,
|
||||
@ -17,23 +14,20 @@ class ThreeGangSwitch1Function extends BaseSwitchFunction {
|
||||
List<SwitchOperationalValue> getOperationalValues() => [
|
||||
SwitchOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: 'ON',
|
||||
description: "ON",
|
||||
value: true,
|
||||
),
|
||||
SwitchOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: 'OFF',
|
||||
description: "OFF",
|
||||
value: false,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
class ThreeGangCountdown1Function extends BaseSwitchFunction {
|
||||
ThreeGangCountdown1Function({
|
||||
required super.deviceId,
|
||||
required super.deviceName,
|
||||
required String type,
|
||||
}) : super(
|
||||
ThreeGangCountdown1Function({required super.deviceId, required super.deviceName ,required type})
|
||||
: super(
|
||||
code: 'countdown_1',
|
||||
operationName: 'Light 1 Countdown',
|
||||
icon: Assets.assetsLightCountdown,
|
||||
@ -43,7 +37,7 @@ class ThreeGangCountdown1Function extends BaseSwitchFunction {
|
||||
List<SwitchOperationalValue> getOperationalValues() => [
|
||||
SwitchOperationalValue(
|
||||
icon: '',
|
||||
description: 'sec',
|
||||
description: "sec",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 43200,
|
||||
@ -53,11 +47,8 @@ class ThreeGangCountdown1Function extends BaseSwitchFunction {
|
||||
}
|
||||
|
||||
class ThreeGangSwitch2Function extends BaseSwitchFunction {
|
||||
ThreeGangSwitch2Function({
|
||||
required super.deviceId,
|
||||
required super.deviceName,
|
||||
required String type,
|
||||
}) : super(
|
||||
ThreeGangSwitch2Function({required super.deviceId, required super.deviceName, required type})
|
||||
: super(
|
||||
code: 'switch_2',
|
||||
operationName: 'Light 2 Switch',
|
||||
icon: Assets.assetsAcPower,
|
||||
@ -67,23 +58,20 @@ class ThreeGangSwitch2Function extends BaseSwitchFunction {
|
||||
List<SwitchOperationalValue> getOperationalValues() => [
|
||||
SwitchOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: 'ON',
|
||||
description: "ON",
|
||||
value: true,
|
||||
),
|
||||
SwitchOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: 'OFF',
|
||||
description: "OFF",
|
||||
value: false,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
class ThreeGangCountdown2Function extends BaseSwitchFunction {
|
||||
ThreeGangCountdown2Function({
|
||||
required super.deviceId,
|
||||
required super.deviceName,
|
||||
required String type,
|
||||
}) : super(
|
||||
ThreeGangCountdown2Function({required super.deviceId, required super.deviceName ,required type})
|
||||
: super(
|
||||
code: 'countdown_2',
|
||||
operationName: 'Light 2 Countdown',
|
||||
icon: Assets.assetsLightCountdown,
|
||||
@ -93,7 +81,7 @@ class ThreeGangCountdown2Function extends BaseSwitchFunction {
|
||||
List<SwitchOperationalValue> getOperationalValues() => [
|
||||
SwitchOperationalValue(
|
||||
icon: '',
|
||||
description: 'sec',
|
||||
description: "sec",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 43200,
|
||||
@ -103,11 +91,8 @@ class ThreeGangCountdown2Function extends BaseSwitchFunction {
|
||||
}
|
||||
|
||||
class ThreeGangSwitch3Function extends BaseSwitchFunction {
|
||||
ThreeGangSwitch3Function({
|
||||
required super.deviceId,
|
||||
required super.deviceName,
|
||||
required String type,
|
||||
}) : super(
|
||||
ThreeGangSwitch3Function({required super.deviceId, required super.deviceName ,required type})
|
||||
: super(
|
||||
code: 'switch_3',
|
||||
operationName: 'Light 3 Switch',
|
||||
icon: Assets.assetsAcPower,
|
||||
@ -117,23 +102,20 @@ class ThreeGangSwitch3Function extends BaseSwitchFunction {
|
||||
List<SwitchOperationalValue> getOperationalValues() => [
|
||||
SwitchOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: 'ON',
|
||||
description: "ON",
|
||||
value: true,
|
||||
),
|
||||
SwitchOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: 'OFF',
|
||||
description: "OFF",
|
||||
value: false,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
class ThreeGangCountdown3Function extends BaseSwitchFunction {
|
||||
ThreeGangCountdown3Function({
|
||||
required super.deviceId,
|
||||
required super.deviceName,
|
||||
required String type,
|
||||
}) : super(
|
||||
ThreeGangCountdown3Function({required super.deviceId, required super.deviceName ,required type})
|
||||
: super(
|
||||
code: 'countdown_3',
|
||||
operationName: 'Light 3 Countdown',
|
||||
icon: Assets.assetsLightCountdown,
|
||||
@ -143,7 +125,7 @@ class ThreeGangCountdown3Function extends BaseSwitchFunction {
|
||||
List<SwitchOperationalValue> getOperationalValues() => [
|
||||
SwitchOperationalValue(
|
||||
icon: '',
|
||||
description: 'sec',
|
||||
description: "sec",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 43200,
|
||||
|
@ -14,12 +14,12 @@ class TwoGangSwitch1Function extends BaseSwitchFunction {
|
||||
List<SwitchOperationalValue> getOperationalValues() => [
|
||||
SwitchOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: 'ON',
|
||||
description: "ON",
|
||||
value: true,
|
||||
),
|
||||
SwitchOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: 'OFF',
|
||||
description: "OFF",
|
||||
value: false,
|
||||
),
|
||||
];
|
||||
@ -37,20 +37,19 @@ class TwoGangSwitch2Function extends BaseSwitchFunction {
|
||||
List<SwitchOperationalValue> getOperationalValues() => [
|
||||
SwitchOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: 'ON',
|
||||
description: "ON",
|
||||
value: true,
|
||||
),
|
||||
SwitchOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: 'OFF',
|
||||
description: "OFF",
|
||||
value: false,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
class TwoGangCountdown1Function extends BaseSwitchFunction {
|
||||
TwoGangCountdown1Function(
|
||||
{required super.deviceId, required super.deviceName})
|
||||
TwoGangCountdown1Function({required super.deviceId, required super.deviceName})
|
||||
: super(
|
||||
code: 'countdown_1',
|
||||
operationName: 'Light 1 Countdown',
|
||||
@ -61,7 +60,7 @@ class TwoGangCountdown1Function extends BaseSwitchFunction {
|
||||
List<SwitchOperationalValue> getOperationalValues() => [
|
||||
SwitchOperationalValue(
|
||||
icon: '',
|
||||
description: 'sec',
|
||||
description: "sec",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 43200,
|
||||
@ -71,8 +70,7 @@ class TwoGangCountdown1Function extends BaseSwitchFunction {
|
||||
}
|
||||
|
||||
class TwoGangCountdown2Function extends BaseSwitchFunction {
|
||||
TwoGangCountdown2Function(
|
||||
{required super.deviceId, required super.deviceName})
|
||||
TwoGangCountdown2Function({required super.deviceId, required super.deviceName})
|
||||
: super(
|
||||
code: 'countdown_2',
|
||||
operationName: 'Light 2 Countdown',
|
||||
@ -83,7 +81,7 @@ class TwoGangCountdown2Function extends BaseSwitchFunction {
|
||||
List<SwitchOperationalValue> getOperationalValues() => [
|
||||
SwitchOperationalValue(
|
||||
icon: '',
|
||||
description: 'sec',
|
||||
description: "sec",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 43200,
|
||||
|
@ -13,8 +13,7 @@ class GatewayOperationalValue {
|
||||
});
|
||||
}
|
||||
|
||||
abstract class GatewayFunctions
|
||||
extends DeviceFunction<GatewayOperationalValue> {
|
||||
abstract class GatewayFunctions extends DeviceFunction<GatewayOperationalValue> {
|
||||
final String type;
|
||||
|
||||
GatewayFunctions({
|
||||
@ -44,12 +43,12 @@ final class GatewaySwitchAlarmSound extends GatewayFunctions {
|
||||
List<GatewayOperationalValue> getOperationalValues() => [
|
||||
GatewayOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: 'ON',
|
||||
description: "ON",
|
||||
value: true,
|
||||
),
|
||||
GatewayOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: 'OFF',
|
||||
description: "OFF",
|
||||
value: false,
|
||||
),
|
||||
];
|
||||
@ -71,12 +70,12 @@ final class GatewayMasterState extends GatewayFunctions {
|
||||
return [
|
||||
GatewayOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: 'Normal',
|
||||
description: "Normal",
|
||||
value: 'normal',
|
||||
),
|
||||
GatewayOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: 'Alarm',
|
||||
description: "Alarm",
|
||||
value: 'alarm',
|
||||
),
|
||||
];
|
||||
@ -99,12 +98,12 @@ final class GatewayFactoryReset extends GatewayFunctions {
|
||||
return [
|
||||
GatewayOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: 'ON',
|
||||
description: "ON",
|
||||
value: true,
|
||||
),
|
||||
GatewayOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: 'OFF',
|
||||
description: "OFF",
|
||||
value: false,
|
||||
),
|
||||
];
|
||||
|
@ -35,7 +35,7 @@ class TotalEnergyConsumedStatusFunction extends EnergyClampFunctions {
|
||||
min: 0.00,
|
||||
max: 20000000.00,
|
||||
step: 1,
|
||||
unit: 'kWh',
|
||||
unit: "kWh",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -54,7 +54,7 @@ class TotalActivePowerConsumedStatusFunction extends EnergyClampFunctions {
|
||||
min: -19800000,
|
||||
max: 19800000,
|
||||
step: 0.1,
|
||||
unit: 'kW',
|
||||
unit: "kW",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -101,7 +101,7 @@ class TotalCurrentStatusFunction extends EnergyClampFunctions {
|
||||
min: 0.000,
|
||||
max: 9000.000,
|
||||
step: 1,
|
||||
unit: 'A',
|
||||
unit: "A",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -120,7 +120,7 @@ class FrequencyStatusFunction extends EnergyClampFunctions {
|
||||
min: 0,
|
||||
max: 80,
|
||||
step: 1,
|
||||
unit: 'Hz',
|
||||
unit: "Hz",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -140,7 +140,7 @@ class EnergyConsumedAStatusFunction extends EnergyClampFunctions {
|
||||
min: 0.00,
|
||||
max: 20000000.00,
|
||||
step: 1,
|
||||
unit: 'kWh',
|
||||
unit: "kWh",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -159,7 +159,7 @@ class ActivePowerAStatusFunction extends EnergyClampFunctions {
|
||||
min: 200,
|
||||
max: 300,
|
||||
step: 1,
|
||||
unit: 'kW',
|
||||
unit: "kW",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -178,7 +178,7 @@ class VoltageAStatusFunction extends EnergyClampFunctions {
|
||||
min: 0.0,
|
||||
max: 500,
|
||||
step: 1,
|
||||
unit: 'V',
|
||||
unit: "V",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -197,7 +197,7 @@ class PowerFactorAStatusFunction extends EnergyClampFunctions {
|
||||
min: 0.00,
|
||||
max: 1.00,
|
||||
step: 0.1,
|
||||
unit: '',
|
||||
unit: "",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -216,7 +216,7 @@ class CurrentAStatusFunction extends EnergyClampFunctions {
|
||||
min: 0.000,
|
||||
max: 3000.000,
|
||||
step: 1,
|
||||
unit: 'A',
|
||||
unit: "A",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -236,7 +236,7 @@ class EnergyConsumedBStatusFunction extends EnergyClampFunctions {
|
||||
min: 0.00,
|
||||
max: 20000000.00,
|
||||
step: 1,
|
||||
unit: 'kWh',
|
||||
unit: "kWh",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -255,7 +255,7 @@ class ActivePowerBStatusFunction extends EnergyClampFunctions {
|
||||
min: -6600000,
|
||||
max: 6600000,
|
||||
step: 1,
|
||||
unit: 'kW',
|
||||
unit: "kW",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -274,7 +274,7 @@ class VoltageBStatusFunction extends EnergyClampFunctions {
|
||||
min: 0.0,
|
||||
max: 500,
|
||||
step: 1,
|
||||
unit: 'V',
|
||||
unit: "V",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -293,7 +293,7 @@ class CurrentBStatusFunction extends EnergyClampFunctions {
|
||||
min: 0.000,
|
||||
max: 3000.000,
|
||||
step: 1,
|
||||
unit: 'A',
|
||||
unit: "A",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -312,7 +312,7 @@ class PowerFactorBStatusFunction extends EnergyClampFunctions {
|
||||
min: 0.0,
|
||||
max: 1.0,
|
||||
step: 0.1,
|
||||
unit: '',
|
||||
unit: "",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -332,7 +332,7 @@ class EnergyConsumedCStatusFunction extends EnergyClampFunctions {
|
||||
min: 0.00,
|
||||
max: 20000000.00,
|
||||
step: 1,
|
||||
unit: 'kWh',
|
||||
unit: "kWh",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -351,7 +351,7 @@ class ActivePowerCStatusFunction extends EnergyClampFunctions {
|
||||
min: -6600000,
|
||||
max: 6600000,
|
||||
step: 1,
|
||||
unit: 'kW',
|
||||
unit: "kW",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -370,7 +370,7 @@ class VoltageCStatusFunction extends EnergyClampFunctions {
|
||||
min: 0.00,
|
||||
max: 500,
|
||||
step: 0.1,
|
||||
unit: 'V',
|
||||
unit: "V",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -389,7 +389,7 @@ class CurrentCStatusFunction extends EnergyClampFunctions {
|
||||
min: 0.000,
|
||||
max: 3000.000,
|
||||
step: 0.1,
|
||||
unit: 'A',
|
||||
unit: "A",
|
||||
);
|
||||
|
||||
@override
|
||||
@ -408,7 +408,7 @@ class PowerFactorCStatusFunction extends EnergyClampFunctions {
|
||||
min: 0.00,
|
||||
max: 1.00,
|
||||
step: 0.1,
|
||||
unit: '',
|
||||
unit: "",
|
||||
);
|
||||
|
||||
@override
|
||||
|
@ -48,8 +48,7 @@ class RoutineDetailsModel {
|
||||
spaceUuid: spaceUuid,
|
||||
automationName: name,
|
||||
decisionExpr: decisionExpr,
|
||||
effectiveTime:
|
||||
effectiveTime ?? EffectiveTime(start: '', end: '', loops: ''),
|
||||
effectiveTime: effectiveTime ?? EffectiveTime(start: '', end: '', loops: ''),
|
||||
conditions: conditions?.map((c) => c.toCondition()).toList() ?? [],
|
||||
actions: actions.map((a) => a.toAutomationAction()).toList(),
|
||||
);
|
||||
@ -64,8 +63,7 @@ class RoutineDetailsModel {
|
||||
if (iconId != null) 'iconUuid': iconId,
|
||||
if (showInDevice != null) 'showInDevice': showInDevice,
|
||||
if (effectiveTime != null) 'effectiveTime': effectiveTime!.toMap(),
|
||||
if (conditions != null)
|
||||
'conditions': conditions!.map((x) => x.toMap()).toList(),
|
||||
if (conditions != null) 'conditions': conditions!.map((x) => x.toMap()).toList(),
|
||||
if (type != null) 'type': type,
|
||||
if (sceneId != null) 'sceneId': sceneId,
|
||||
if (automationId != null) 'automationId': automationId,
|
||||
@ -82,12 +80,10 @@ class RoutineDetailsModel {
|
||||
),
|
||||
iconId: map['iconUuid'],
|
||||
showInDevice: map['showInDevice'],
|
||||
effectiveTime: map['effectiveTime'] != null
|
||||
? EffectiveTime.fromMap(map['effectiveTime'])
|
||||
: null,
|
||||
effectiveTime:
|
||||
map['effectiveTime'] != null ? EffectiveTime.fromMap(map['effectiveTime']) : null,
|
||||
conditions: map['conditions'] != null
|
||||
? List<RoutineCondition>.from(
|
||||
map['conditions'].map((x) => RoutineCondition.fromMap(x)))
|
||||
? List<RoutineCondition>.from(map['conditions'].map((x) => RoutineCondition.fromMap(x)))
|
||||
: null,
|
||||
type: map['type'],
|
||||
sceneId: map['sceneId'],
|
||||
@ -141,8 +137,7 @@ class RoutineAction {
|
||||
'actionExecutor': actionExecutor,
|
||||
if (type != null) 'type': type,
|
||||
if (name != null) 'name': name,
|
||||
if (executorProperty != null)
|
||||
'executorProperty': executorProperty!.toMap(),
|
||||
if (executorProperty != null) 'executorProperty': executorProperty!.toMap(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -42,27 +42,27 @@ class ScenesModel {
|
||||
factory ScenesModel.fromJson(Map<String, dynamic> json,
|
||||
{bool? isAutomation}) {
|
||||
return ScenesModel(
|
||||
id: json['id'] ?? json['uuid'] ?? '',
|
||||
sceneTuyaId: json['sceneTuyaId'] as String?,
|
||||
name: json['name'] ?? '',
|
||||
status: json['status'] ?? '',
|
||||
type: json['type'] ?? '',
|
||||
spaceName: json['spaceName'] ?? '',
|
||||
spaceId: json['spaceId'] ?? '',
|
||||
communityId: json['communityId'] ?? '',
|
||||
id: json["id"] ?? json["uuid"] ?? '',
|
||||
sceneTuyaId: json["sceneTuyaId"] as String?,
|
||||
name: json["name"] ?? '',
|
||||
status: json["status"] ?? '',
|
||||
type: json["type"] ?? '',
|
||||
spaceName: json["spaceName"] ?? '',
|
||||
spaceId: json["spaceId"] ?? '',
|
||||
communityId: json["communityId"] ?? '',
|
||||
icon:
|
||||
isAutomation == true ? Assets.automation : (json['icon'] as String?),
|
||||
isAutomation == true ? Assets.automation : (json["icon"] as String?),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'sceneTuyaId': sceneTuyaId ?? '',
|
||||
'name': name,
|
||||
'status': status,
|
||||
'type': type,
|
||||
'spaceName': spaceName,
|
||||
'spaceId': spaceId,
|
||||
'communityId': communityId,
|
||||
"id": id,
|
||||
"sceneTuyaId": sceneTuyaId ?? '',
|
||||
"name": name,
|
||||
"status": status,
|
||||
"type": type,
|
||||
"spaceName": spaceName,
|
||||
"spaceId": spaceId,
|
||||
"communityId": communityId,
|
||||
};
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ class WHRestartStatusFunction extends WaterHeaterFunctions {
|
||||
operationName: 'Restart Status',
|
||||
icon: Assets.refreshStatusIcon,
|
||||
);
|
||||
|
||||
|
||||
@override
|
||||
List<WaterHeaterOperationalValue> getOperationalValues() {
|
||||
@ -36,7 +37,7 @@ class WHRestartStatusFunction extends WaterHeaterFunctions {
|
||||
WaterHeaterOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: 'Power OFF',
|
||||
value: 'off',
|
||||
value: "off",
|
||||
),
|
||||
WaterHeaterOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
@ -45,7 +46,7 @@ class WHRestartStatusFunction extends WaterHeaterFunctions {
|
||||
),
|
||||
WaterHeaterOperationalValue(
|
||||
icon: Assets.refreshStatusIcon,
|
||||
description: 'Restart Memory',
|
||||
description: "Restart Memory",
|
||||
value: 'memory',
|
||||
),
|
||||
];
|
||||
@ -104,7 +105,8 @@ class BacklightFunction extends WaterHeaterFunctions {
|
||||
required super.deviceId,
|
||||
required super.deviceName,
|
||||
required super.type,
|
||||
}) : super(
|
||||
}) :
|
||||
super(
|
||||
code: 'switch_backlight',
|
||||
operationName: 'Backlight',
|
||||
icon: Assets.indicator,
|
||||
|
@ -24,11 +24,11 @@ abstract class WpsFunctions extends DeviceFunction<WallSensorModel> {
|
||||
|
||||
// For far_detection (75-600cm in 75cm steps)
|
||||
class FarDetectionFunction extends WpsFunctions {
|
||||
@override
|
||||
|
||||
final double min;
|
||||
@override
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
@override
|
||||
final double step;
|
||||
@override
|
||||
final String unit;
|
||||
@ -62,13 +62,9 @@ class FarDetectionFunction extends WpsFunctions {
|
||||
|
||||
// For presence_time (0-65535 minutes)
|
||||
class PresenceTimeFunction extends WpsFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
@override
|
||||
final String unit;
|
||||
|
||||
PresenceTimeFunction(
|
||||
@ -98,11 +94,8 @@ class PresenceTimeFunction extends WpsFunctions {
|
||||
|
||||
// For motion_sensitivity_value (1-5 levels)
|
||||
class MotionSensitivityFunction extends WpsFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
MotionSensitivityFunction(
|
||||
@ -131,11 +124,8 @@ class MotionSensitivityFunction extends WpsFunctions {
|
||||
}
|
||||
|
||||
class MotionLessSensitivityFunction extends WpsFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
MotionLessSensitivityFunction(
|
||||
@ -177,23 +167,20 @@ class IndicatorFunction extends WpsFunctions {
|
||||
List<WpsOperationalValue> getOperationalValues() => [
|
||||
WpsOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: 'ON',
|
||||
description: "ON",
|
||||
value: true,
|
||||
),
|
||||
WpsOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: 'OFF',
|
||||
description: "OFF",
|
||||
value: false,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
class NoOneTimeFunction extends WpsFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final String unit;
|
||||
|
||||
NoOneTimeFunction(
|
||||
@ -234,23 +221,20 @@ class PresenceStateFunction extends WpsFunctions {
|
||||
List<WpsOperationalValue> getOperationalValues() => [
|
||||
WpsOperationalValue(
|
||||
icon: Assets.assetsAcPower,
|
||||
description: 'None',
|
||||
description: "None",
|
||||
value: 'none',
|
||||
),
|
||||
WpsOperationalValue(
|
||||
icon: Assets.presenceStateIcon,
|
||||
description: 'Presence',
|
||||
description: "Presence",
|
||||
value: 'presence',
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
class CurrentDistanceFunction extends WpsFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
CurrentDistanceFunction(
|
||||
@ -267,11 +251,11 @@ class CurrentDistanceFunction extends WpsFunctions {
|
||||
|
||||
@override
|
||||
List<WpsOperationalValue> getOperationalValues() {
|
||||
final values = <WpsOperationalValue>[];
|
||||
for (var cm = min.toInt(); cm <= max; cm += step.toInt()) {
|
||||
List<WpsOperationalValue> values = [];
|
||||
for (int cm = min.toInt(); cm <= max; cm += step.toInt()) {
|
||||
values.add(WpsOperationalValue(
|
||||
icon: Assets.assetsTempreture,
|
||||
description: '${cm}CM',
|
||||
description: "${cm}CM",
|
||||
value: cm,
|
||||
));
|
||||
}
|
||||
@ -280,11 +264,8 @@ class CurrentDistanceFunction extends WpsFunctions {
|
||||
}
|
||||
|
||||
class IlluminanceValueFunction extends WpsFunctions {
|
||||
@override
|
||||
final double min;
|
||||
@override
|
||||
final double max;
|
||||
@override
|
||||
final double step;
|
||||
|
||||
IlluminanceValueFunction({
|
||||
@ -302,11 +283,11 @@ class IlluminanceValueFunction extends WpsFunctions {
|
||||
|
||||
@override
|
||||
List<WpsOperationalValue> getOperationalValues() {
|
||||
final values = <WpsOperationalValue>[];
|
||||
for (var lux = min.toInt(); lux <= max; lux += step.toInt()) {
|
||||
List<WpsOperationalValue> values = [];
|
||||
for (int lux = min.toInt(); lux <= max; lux += step.toInt()) {
|
||||
values.add(WpsOperationalValue(
|
||||
icon: Assets.IlluminanceIcon,
|
||||
description: '$lux Lux',
|
||||
description: "$lux Lux",
|
||||
value: lux,
|
||||
));
|
||||
}
|
||||
|
Reference in New Issue
Block a user