Added current temp to AC functions

This commit is contained in:
Abdullah Alassaf
2025-03-11 23:41:21 +03:00
parent 41605bef6b
commit b563cc378e
4 changed files with 37 additions and 2 deletions

View File

@ -244,6 +244,7 @@ SOS
SwitchFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
ModeFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
TempSetFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
CurrentTempFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
LevelFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
ChildLockFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
];

View File

@ -41,6 +41,11 @@ class DeviceDialogHelper {
final deviceSelectedFunctions =
routineBloc.state.selectedFunctions[data['uniqueCustomId']] ?? [];
if (removeComparetors) {
//remove the current temp function in the 'if container'
functions.removeAt(3);
}
switch (productType) {
case 'AC':
return ACHelper.showACFunctionsDialog(context, functions, data['device'],

View File

@ -151,3 +151,32 @@ class ChildLockFunction extends ACFunction {
),
];
}
class CurrentTempFunction extends ACFunction {
final int min;
final int max;
final int step;
CurrentTempFunction({required super.deviceId, required super.deviceName})
: min = -100,
max = 990,
step = 1,
super(
code: 'temp_current',
operationName: 'Current Temperature',
icon: Assets.currentTemp,
);
@override
List<ACOperationalValue> getOperationalValues() {
List<ACOperationalValue> values = [];
for (int temp = min; temp <= max; temp += step) {
values.add(ACOperationalValue(
icon: Assets.currentTemp,
description: "${temp / 10}°C",
value: temp,
));
}
return values;
}
}

View File

@ -329,8 +329,8 @@ class ACHelper {
) {
return Slider(
value: initialValue is int ? initialValue.toDouble() : 200.0,
min: 200,
max: 300,
min: selectCode == 'temp_current' ? -100 : 200,
max: selectCode == 'temp_current' ? 900 : 300,
divisions: 10,
label: '${((initialValue ?? 160) / 10).toInt()}°C',
onChanged: (value) {