formatted all files.

This commit is contained in:
Faris Armoush
2025-06-12 15:33:32 +03:00
parent 29959f567e
commit 04250ebc98
474 changed files with 5425 additions and 4338 deletions

View File

@ -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,22 +90,23 @@ class TempSetFunction extends ACFunction {
min: 200,
max: 300,
step: 1,
unit: "°C",
unit: '°C',
);
@override
List<ACOperationalValue> getOperationalValues() {
List<ACOperationalValue> values = [];
for (int temp = min!.toInt(); temp <= max!; temp += step!.toInt()) {
final values = <ACOperationalValue>[];
for (var 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})
@ -120,22 +121,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,
),
];
@ -155,22 +156,26 @@ 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;
final String unit = "°C";
@override
final String unit = '°C';
CurrentTempFunction(
{required super.deviceId, required super.deviceName, required type})
@ -186,11 +191,11 @@ class CurrentTempFunction extends ACFunction {
@override
List<ACOperationalValue> getOperationalValues() {
List<ACOperationalValue> values = [];
for (int temp = min.toInt(); temp <= max; temp += step.toInt()) {
final values = <ACOperationalValue>[];
for (var temp = min.toInt(); temp <= max; temp += step.toInt()) {
values.add(ACOperationalValue(
icon: Assets.currentTemp,
description: "${temp / 10}°C",
description: '${temp / 10}°C',
value: temp,
));
}

View File

@ -6,12 +6,10 @@ class CpsOperationalValue {
final String description;
final dynamic value;
CpsOperationalValue({
required this.icon,
required this.description,
required this.value,
});
}
@ -45,12 +43,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,
),
];
@ -71,12 +69,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,
),
];
@ -96,8 +94,11 @@ final class CpsSensitivityFunction extends CpsFunctions {
icon: Assets.sensitivity,
);
@override
final double min;
@override
final double max;
@override
final double step;
static const _images = <String>[
@ -144,8 +145,11 @@ final class CpsMovingSpeedFunction extends CpsFunctions {
icon: Assets.speedoMeter,
);
@override
final double min;
@override
final double max;
@override
final double step;
@override
@ -175,8 +179,11 @@ final class CpsSpatialStaticValueFunction extends CpsFunctions {
icon: Assets.spatialStaticValue,
);
@override
final double min;
@override
final double max;
@override
final double step;
@override
@ -206,8 +213,11 @@ final class CpsSpatialMotionValueFunction extends CpsFunctions {
icon: Assets.spatialMotionValue,
);
@override
final double min;
@override
final double max;
@override
final double step;
@override
@ -237,8 +247,11 @@ final class CpsMaxDistanceOfDetectionFunction extends CpsFunctions {
icon: Assets.currentDistanceIcon,
);
@override
final double min;
@override
final double max;
@override
final double step;
@override
@ -247,7 +260,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',
@ -272,8 +285,11 @@ final class CpsMaxDistanceOfStaticDetectionFunction extends CpsFunctions {
icon: Assets.currentDistanceIcon,
);
@override
final double min;
@override
final double max;
@override
final double step;
@override
@ -282,7 +298,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',
@ -307,8 +323,11 @@ final class CpsDetectionRangeFunction extends CpsFunctions {
icon: Assets.farDetection,
);
@override
final double min;
@override
final double max;
@override
final double step;
@override
@ -317,7 +336,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',
@ -342,8 +361,11 @@ final class CpsDistanceOfMovingObjectsFunction extends CpsFunctions {
icon: Assets.currentDistanceIcon,
);
@override
final double min;
@override
final double max;
@override
final double step;
@override
@ -352,7 +374,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',
@ -377,8 +399,11 @@ final class CpsPresenceJudgementThrsholdFunction extends CpsFunctions {
icon: Assets.presenceJudgementThrshold,
);
@override
final double min;
@override
final double max;
@override
final double step;
@override
@ -408,8 +433,11 @@ final class CpsMotionAmplitudeTriggerThresholdFunction extends CpsFunctions {
icon: Assets.presenceJudgementThrshold,
);
@override
final double min;
@override
final double max;
@override
final double step;
@override
@ -439,8 +467,11 @@ final class CpsPerpetualBoundaryFunction extends CpsFunctions {
icon: Assets.boundary,
);
@override
final double min;
@override
final double max;
@override
final double step;
@override
@ -449,7 +480,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',
@ -474,8 +505,11 @@ final class CpsMotionTriggerBoundaryFunction extends CpsFunctions {
icon: Assets.motionMeter,
);
@override
final double min;
@override
final double max;
@override
final double step;
@override
@ -484,7 +518,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',
@ -509,8 +543,11 @@ final class CpsMotionTriggerTimeFunction extends CpsFunctions {
icon: Assets.motionMeter,
);
@override
final double min;
@override
final double max;
@override
final double step;
@override
@ -519,7 +556,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',
@ -544,8 +581,11 @@ final class CpsMotionToStaticTimeFunction extends CpsFunctions {
icon: Assets.motionMeter,
);
@override
final double min;
@override
final double max;
@override
final double step;
@override
@ -554,7 +594,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',
@ -579,8 +619,11 @@ final class CpsEnteringNoBodyStateTimeFunction extends CpsFunctions {
icon: Assets.motionMeter,
);
@override
final double min;
@override
final double max;
@override
final double step;
@override
@ -589,7 +632,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',
@ -869,8 +912,11 @@ final class CpsSportsParaFunction extends CpsFunctions {
icon: Assets.sportsPara,
);
@override
final double min;
@override
final double max;
@override
final double step;
@override
@ -879,7 +925,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),

View File

@ -112,7 +112,7 @@ class CreateSceneAction {
CreateSceneExecutorProperty? executorProperty,
}) {
return CreateSceneAction(
actionType: actionType ?? this.actionType,
actionType: actionType ?? 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,
};

View File

@ -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,

View File

@ -24,8 +24,7 @@ class FlushPresenceDelayFunction extends FlushFunctions {
required super.deviceId,
required super.deviceName,
required super.type,
}) :
super(
}) : super(
code: FlushMountedPresenceSensorModel.codePresenceState,
operationName: 'Presence State',
icon: Assets.presenceStateIcon,
@ -37,7 +36,7 @@ class FlushPresenceDelayFunction extends FlushFunctions {
FlushOperationalValue(
icon: Assets.nobodyTime,
description: 'None',
value: "none",
value: 'none',
),
FlushOperationalValue(
icon: Assets.presenceStateIcon,
@ -49,8 +48,11 @@ class FlushPresenceDelayFunction extends FlushFunctions {
}
class FlushSensiReduceFunction extends FlushFunctions {
@override
final double min;
@override
final double max;
@override
final double step;
FlushSensiReduceFunction({
@ -79,8 +81,11 @@ class FlushSensiReduceFunction extends FlushFunctions {
}
class FlushNoneDelayFunction extends FlushFunctions {
@override
final double min;
@override
final double max;
@override
final String unit;
FlushNoneDelayFunction({
@ -109,8 +114,11 @@ class FlushNoneDelayFunction extends FlushFunctions {
}
class FlushIlluminanceFunction extends FlushFunctions {
@override
final double min;
@override
final double max;
@override
final double step;
FlushIlluminanceFunction({
@ -128,11 +136,11 @@ class FlushIlluminanceFunction extends FlushFunctions {
@override
List<FlushOperationalValue> getOperationalValues() {
List<FlushOperationalValue> values = [];
for (int lux = min.toInt(); lux <= max; lux += step.toInt()) {
final values = <FlushOperationalValue>[];
for (var lux = min.toInt(); lux <= max; lux += step.toInt()) {
values.add(FlushOperationalValue(
icon: Assets.IlluminanceIcon,
description: "$lux Lux",
description: '$lux Lux',
value: lux,
));
}
@ -141,8 +149,11 @@ class FlushIlluminanceFunction extends FlushFunctions {
}
class FlushOccurDistReduceFunction extends FlushFunctions {
@override
final double min;
@override
final double max;
@override
final double step;
FlushOccurDistReduceFunction({
@ -172,8 +183,11 @@ class FlushOccurDistReduceFunction extends FlushFunctions {
// ==== then functions ====
class FlushSensitivityFunction extends FlushFunctions {
@override
final double min;
@override
final double max;
@override
final double step;
FlushSensitivityFunction({
@ -202,9 +216,13 @@ 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({
@ -224,7 +242,7 @@ class FlushNearDetectionFunction extends FlushFunctions {
@override
List<FlushOperationalValue> getOperationalValues() {
final values = <FlushOperationalValue>[];
for (var value = min.toDouble(); value <= max; value += step) {
for (var value = min; value <= max; value += step) {
values.add(FlushOperationalValue(
icon: Assets.nobodyTime,
description: '$value $unit',
@ -236,9 +254,13 @@ 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({
@ -270,9 +292,13 @@ 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({
@ -292,7 +318,7 @@ class FlushTargetConfirmTimeFunction extends FlushFunctions {
@override
List<FlushOperationalValue> getOperationalValues() {
final values = <FlushOperationalValue>[];
for (var value = min.toDouble(); value <= max; value += step) {
for (var value = min; value <= max; value += step) {
values.add(FlushOperationalValue(
icon: Assets.nobodyTime,
description: '$value $unit',
@ -304,9 +330,13 @@ 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({
@ -326,7 +356,7 @@ class FlushDisappeDelayFunction extends FlushFunctions {
@override
List<FlushOperationalValue> getOperationalValues() {
final values = <FlushOperationalValue>[];
for (var value = min.toDouble(); value <= max; value += step) {
for (var value = min; value <= max; value += step) {
values.add(FlushOperationalValue(
icon: Assets.nobodyTime,
description: '$value $unit',
@ -338,9 +368,13 @@ 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({
@ -360,7 +394,7 @@ class FlushIndentLevelFunction extends FlushFunctions {
@override
List<FlushOperationalValue> getOperationalValues() {
final values = <FlushOperationalValue>[];
for (var value = min.toDouble(); value <= max; value += step) {
for (var value = min; value <= max; value += step) {
values.add(FlushOperationalValue(
icon: Assets.nobodyTime,
description: '$value $unit',
@ -372,9 +406,13 @@ 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({
@ -394,7 +432,7 @@ class FlushTriggerLevelFunction extends FlushFunctions {
@override
List<FlushOperationalValue> getOperationalValues() {
final values = <FlushOperationalValue>[];
for (var value = min.toDouble(); value <= max; value += step) {
for (var value = min; value <= max; value += step) {
values.add(FlushOperationalValue(
icon: Assets.nobodyTime,
description: '$value $unit',

View File

@ -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,

View File

@ -3,8 +3,11 @@ 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 type})
: super(
ThreeGangSwitch1Function({
required super.deviceId,
required super.deviceName,
required String type,
}) : super(
code: 'switch_1',
operationName: 'Light 1 Switch',
icon: Assets.assetsAcPower,
@ -14,20 +17,23 @@ 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 type})
: super(
ThreeGangCountdown1Function({
required super.deviceId,
required super.deviceName,
required String type,
}) : super(
code: 'countdown_1',
operationName: 'Light 1 Countdown',
icon: Assets.assetsLightCountdown,
@ -37,7 +43,7 @@ class ThreeGangCountdown1Function extends BaseSwitchFunction {
List<SwitchOperationalValue> getOperationalValues() => [
SwitchOperationalValue(
icon: '',
description: "sec",
description: 'sec',
value: 0.0,
minValue: 0,
maxValue: 43200,
@ -47,8 +53,11 @@ class ThreeGangCountdown1Function extends BaseSwitchFunction {
}
class ThreeGangSwitch2Function extends BaseSwitchFunction {
ThreeGangSwitch2Function({required super.deviceId, required super.deviceName, required type})
: super(
ThreeGangSwitch2Function({
required super.deviceId,
required super.deviceName,
required String type,
}) : super(
code: 'switch_2',
operationName: 'Light 2 Switch',
icon: Assets.assetsAcPower,
@ -58,20 +67,23 @@ 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 type})
: super(
ThreeGangCountdown2Function({
required super.deviceId,
required super.deviceName,
required String type,
}) : super(
code: 'countdown_2',
operationName: 'Light 2 Countdown',
icon: Assets.assetsLightCountdown,
@ -81,7 +93,7 @@ class ThreeGangCountdown2Function extends BaseSwitchFunction {
List<SwitchOperationalValue> getOperationalValues() => [
SwitchOperationalValue(
icon: '',
description: "sec",
description: 'sec',
value: 0.0,
minValue: 0,
maxValue: 43200,
@ -91,8 +103,11 @@ class ThreeGangCountdown2Function extends BaseSwitchFunction {
}
class ThreeGangSwitch3Function extends BaseSwitchFunction {
ThreeGangSwitch3Function({required super.deviceId, required super.deviceName ,required type})
: super(
ThreeGangSwitch3Function({
required super.deviceId,
required super.deviceName,
required String type,
}) : super(
code: 'switch_3',
operationName: 'Light 3 Switch',
icon: Assets.assetsAcPower,
@ -102,20 +117,23 @@ 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 type})
: super(
ThreeGangCountdown3Function({
required super.deviceId,
required super.deviceName,
required String type,
}) : super(
code: 'countdown_3',
operationName: 'Light 3 Countdown',
icon: Assets.assetsLightCountdown,
@ -125,7 +143,7 @@ class ThreeGangCountdown3Function extends BaseSwitchFunction {
List<SwitchOperationalValue> getOperationalValues() => [
SwitchOperationalValue(
icon: '',
description: "sec",
description: 'sec',
value: 0.0,
minValue: 0,
maxValue: 43200,

View File

@ -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,19 +37,20 @@ 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',
@ -60,7 +61,7 @@ class TwoGangCountdown1Function extends BaseSwitchFunction {
List<SwitchOperationalValue> getOperationalValues() => [
SwitchOperationalValue(
icon: '',
description: "sec",
description: 'sec',
value: 0.0,
minValue: 0,
maxValue: 43200,
@ -70,7 +71,8 @@ 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',
@ -81,7 +83,7 @@ class TwoGangCountdown2Function extends BaseSwitchFunction {
List<SwitchOperationalValue> getOperationalValues() => [
SwitchOperationalValue(
icon: '',
description: "sec",
description: 'sec',
value: 0.0,
minValue: 0,
maxValue: 43200,

View File

@ -13,7 +13,8 @@ class GatewayOperationalValue {
});
}
abstract class GatewayFunctions extends DeviceFunction<GatewayOperationalValue> {
abstract class GatewayFunctions
extends DeviceFunction<GatewayOperationalValue> {
final String type;
GatewayFunctions({
@ -43,12 +44,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,
),
];
@ -70,12 +71,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',
),
];
@ -98,12 +99,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,
),
];

View File

@ -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

View File

@ -48,7 +48,8 @@ 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(),
);
@ -63,7 +64,8 @@ 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,
@ -80,10 +82,12 @@ 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'],
@ -137,7 +141,8 @@ 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(),
};
}

View File

@ -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,
};
}

View File

@ -29,7 +29,6 @@ class WHRestartStatusFunction extends WaterHeaterFunctions {
operationName: 'Restart Status',
icon: Assets.refreshStatusIcon,
);
@override
List<WaterHeaterOperationalValue> getOperationalValues() {
@ -37,7 +36,7 @@ class WHRestartStatusFunction extends WaterHeaterFunctions {
WaterHeaterOperationalValue(
icon: Assets.assetsAcPowerOFF,
description: 'Power OFF',
value: "off",
value: 'off',
),
WaterHeaterOperationalValue(
icon: Assets.assetsAcPower,
@ -46,7 +45,7 @@ class WHRestartStatusFunction extends WaterHeaterFunctions {
),
WaterHeaterOperationalValue(
icon: Assets.refreshStatusIcon,
description: "Restart Memory",
description: 'Restart Memory',
value: 'memory',
),
];
@ -105,8 +104,7 @@ class BacklightFunction extends WaterHeaterFunctions {
required super.deviceId,
required super.deviceName,
required super.type,
}) :
super(
}) : super(
code: 'switch_backlight',
operationName: 'Backlight',
icon: Assets.indicator,

View File

@ -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,9 +62,13 @@ 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(
@ -94,8 +98,11 @@ 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(
@ -124,8 +131,11 @@ class MotionSensitivityFunction extends WpsFunctions {
}
class MotionLessSensitivityFunction extends WpsFunctions {
@override
final double min;
@override
final double max;
@override
final double step;
MotionLessSensitivityFunction(
@ -167,20 +177,23 @@ 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(
@ -221,20 +234,23 @@ 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(
@ -251,11 +267,11 @@ class CurrentDistanceFunction extends WpsFunctions {
@override
List<WpsOperationalValue> getOperationalValues() {
List<WpsOperationalValue> values = [];
for (int cm = min.toInt(); cm <= max; cm += step.toInt()) {
final values = <WpsOperationalValue>[];
for (var cm = min.toInt(); cm <= max; cm += step.toInt()) {
values.add(WpsOperationalValue(
icon: Assets.assetsTempreture,
description: "${cm}CM",
description: '${cm}CM',
value: cm,
));
}
@ -264,8 +280,11 @@ class CurrentDistanceFunction extends WpsFunctions {
}
class IlluminanceValueFunction extends WpsFunctions {
@override
final double min;
@override
final double max;
@override
final double step;
IlluminanceValueFunction({
@ -283,11 +302,11 @@ class IlluminanceValueFunction extends WpsFunctions {
@override
List<WpsOperationalValue> getOperationalValues() {
List<WpsOperationalValue> values = [];
for (int lux = min.toInt(); lux <= max; lux += step.toInt()) {
final values = <WpsOperationalValue>[];
for (var lux = min.toInt(); lux <= max; lux += step.toInt()) {
values.add(WpsOperationalValue(
icon: Assets.IlluminanceIcon,
description: "$lux Lux",
description: '$lux Lux',
value: lux,
));
}