mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-26 03:27:54 +00:00
Improved the performance of the AC device
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_event.dart';
|
||||
@@ -12,6 +14,7 @@ import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
||||
final String acId;
|
||||
AcStatusModel deviceStatus = AcStatusModel(
|
||||
uuid: '',
|
||||
acSwitch: true,
|
||||
modeString: 'hot',
|
||||
tempSet: 300,
|
||||
@@ -24,6 +27,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
||||
bool allAcsOn = true;
|
||||
bool allTempSame = true;
|
||||
int globalTemp = 25;
|
||||
Timer? _timer;
|
||||
|
||||
ACsBloc({required this.acId}) : super(AcsInitialState()) {
|
||||
on<AcsInitial>(_fetchAcsStatus);
|
||||
@@ -56,11 +60,11 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
||||
for (var status in response['status']) {
|
||||
statusModelList.add(StatusModel.fromJson(status));
|
||||
}
|
||||
deviceStatus = AcStatusModel.fromJson(statusModelList);
|
||||
deviceStatus = AcStatusModel.fromJson(response['productUuid'], statusModelList);
|
||||
emit(GetAcStatusState(acStatusModel: deviceStatus));
|
||||
}
|
||||
} catch (e) {
|
||||
emit(AcsFailedState(error: e.toString()));
|
||||
emit(AcsFailedState(errorMessage: e.toString()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -68,8 +72,6 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
||||
_getAllAcs() async {
|
||||
deviceStatusList = [];
|
||||
devicesList = [];
|
||||
allAcsOn = true;
|
||||
allTempSame = true;
|
||||
devicesList = await DevicesAPI.getDeviceByGroupName(
|
||||
HomeCubit.getInstance().selectedSpace?.id ?? '', 'AC');
|
||||
|
||||
@@ -79,8 +81,210 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
||||
for (var status in response['status']) {
|
||||
statusModelList.add(StatusModel.fromJson(status));
|
||||
}
|
||||
deviceStatusList.add(AcStatusModel.fromJson(statusModelList));
|
||||
deviceStatusList.add(AcStatusModel.fromJson(response['productUuid'], statusModelList));
|
||||
}
|
||||
_setAllAcsTempsAndSwitches();
|
||||
}
|
||||
|
||||
void _changeAcSwitch(AcSwitch event, Emitter<AcsState> emit) async {
|
||||
final acSwitchValue = !event.acSwitch;
|
||||
if (allAcsPage) {
|
||||
emit(AcsLoadingState());
|
||||
for (AcStatusModel ac in deviceStatusList) {
|
||||
if (ac.uuid == event.productId) {
|
||||
ac.acSwitch = acSwitchValue;
|
||||
}
|
||||
}
|
||||
_setAllAcsTempsAndSwitches();
|
||||
_emitAcsStatus(emit);
|
||||
} else {
|
||||
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
||||
deviceStatus.acSwitch = acSwitchValue;
|
||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||
}
|
||||
|
||||
await _runDeBouncerForOneDevice(deviceId: event.deviceId, code: 'switch', value: acSwitchValue);
|
||||
}
|
||||
|
||||
void _changeAllAcSwitch(ChangeAllSwitch event, Emitter<AcsState> emit) async {
|
||||
emit(AcsLoadingState());
|
||||
if (deviceStatusList.length == devicesList.length) {
|
||||
for (int i = 0; i < deviceStatusList.length; i++) {
|
||||
deviceStatusList[i].acSwitch = event.value;
|
||||
}
|
||||
}
|
||||
_setAllAcsTempsAndSwitches();
|
||||
_emitAcsStatus(emit);
|
||||
_runDeBouncerForAllAcs(code: 'switch', value: event.value);
|
||||
}
|
||||
|
||||
void _increaseAllTemp(IncreaseAllTemp event, Emitter<AcsState> emit) async {
|
||||
emit(AcsLoadingState());
|
||||
double tempValue = event.value + 0.5;
|
||||
int value = (tempValue * 10).toInt();
|
||||
|
||||
if (!_checkTemperatureValue(tempValue, emit)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (deviceStatusList.length == devicesList.length) {
|
||||
for (int i = 0; i < deviceStatusList.length; i++) {
|
||||
deviceStatusList[i].tempSet = value;
|
||||
}
|
||||
}
|
||||
_setAllAcsTempsAndSwitches();
|
||||
_emitAcsStatus(emit);
|
||||
_runDeBouncerForAllAcs(code: 'temp_set', value: value);
|
||||
}
|
||||
|
||||
void _decreaseAllTemp(DecreaseAllTemp event, Emitter<AcsState> emit) async {
|
||||
emit(AcsLoadingState());
|
||||
|
||||
double tempValue = event.value - 0.5;
|
||||
int value = (tempValue * 10).toInt();
|
||||
|
||||
if (!_checkTemperatureValue(tempValue, emit)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (deviceStatusList.length == devicesList.length) {
|
||||
for (int i = 0; i < deviceStatusList.length; i++) {
|
||||
deviceStatusList[i].tempSet = value;
|
||||
}
|
||||
}
|
||||
_setAllAcsTempsAndSwitches();
|
||||
_emitAcsStatus(emit);
|
||||
_runDeBouncerForAllAcs(code: 'temp_set', value: value);
|
||||
}
|
||||
|
||||
void _changeLockValue(ChangeLock event, Emitter<AcsState> emit) async {
|
||||
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
||||
|
||||
final lockValue = !event.lockBool;
|
||||
deviceStatus.childLock = lockValue;
|
||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||
|
||||
_runDeBouncerForOneDevice(deviceId: acId, code: 'child_lock', value: lockValue);
|
||||
}
|
||||
|
||||
void _increaseCoolTo(IncreaseCoolToTemp event, Emitter<AcsState> emit) async {
|
||||
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
||||
|
||||
double tempValue = event.value + 0.5;
|
||||
int value = (tempValue * 10).toInt();
|
||||
|
||||
if (!_checkTemperatureValue(tempValue, emit)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (allAcsPage) {
|
||||
emit(AcsLoadingState());
|
||||
for (AcStatusModel ac in deviceStatusList) {
|
||||
if (ac.uuid == event.productId) {
|
||||
ac.tempSet = value;
|
||||
}
|
||||
}
|
||||
_setAllAcsTempsAndSwitches();
|
||||
_emitAcsStatus(emit);
|
||||
} else {
|
||||
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
||||
deviceStatus.tempSet = value;
|
||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||
}
|
||||
|
||||
await _runDeBouncerForOneDevice(deviceId: event.deviceId, code: 'temp_set', value: value);
|
||||
}
|
||||
|
||||
void _decreaseCoolTo(DecreaseCoolToTemp event, Emitter<AcsState> emit) async {
|
||||
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
||||
|
||||
double tempValue = event.value - 0.5;
|
||||
int value = (tempValue * 10).toInt();
|
||||
|
||||
if (!_checkTemperatureValue(tempValue, emit)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (allAcsPage) {
|
||||
emit(AcsLoadingState());
|
||||
for (AcStatusModel ac in deviceStatusList) {
|
||||
if (ac.uuid == event.productId) {
|
||||
ac.tempSet = value;
|
||||
}
|
||||
}
|
||||
_setAllAcsTempsAndSwitches();
|
||||
_emitAcsStatus(emit);
|
||||
} else {
|
||||
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
||||
deviceStatus.tempSet = value;
|
||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||
}
|
||||
|
||||
await _runDeBouncerForOneDevice(deviceId: event.deviceId, code: 'temp_set', value: value);
|
||||
}
|
||||
|
||||
void _changeAcMode(ChangeAcMode event, Emitter<AcsState> emit) async {
|
||||
final tempMode = tempModesMap[getNextItem(tempModesMap, event.tempModes)]!;
|
||||
if (allAcsPage) {
|
||||
emit(AcsLoadingState());
|
||||
for (AcStatusModel ac in deviceStatusList) {
|
||||
if (ac.uuid == event.productId) {
|
||||
ac.modeString = getACModeString(tempMode);
|
||||
ac.acMode = AcStatusModel.getACMode(getACModeString(tempMode));
|
||||
}
|
||||
}
|
||||
_emitAcsStatus(emit);
|
||||
} else {
|
||||
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
||||
deviceStatus.modeString = getACModeString(tempMode);
|
||||
deviceStatus.acMode = AcStatusModel.getACMode(getACModeString(tempMode));
|
||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||
}
|
||||
|
||||
await _runDeBouncerForOneDevice(
|
||||
deviceId: event.deviceId, code: 'mode', value: getACModeString(tempMode));
|
||||
}
|
||||
|
||||
void _changeFanSpeed(ChangeFanSpeed event, Emitter<AcsState> emit) async {
|
||||
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
||||
|
||||
final fanSpeed = event.fanSpeeds;
|
||||
|
||||
if (allAcsPage) {
|
||||
emit(AcsLoadingState());
|
||||
for (AcStatusModel ac in deviceStatusList) {
|
||||
if (ac.uuid == event.productId) {
|
||||
ac.fanSpeedsString = getNextFanSpeedKey(fanSpeed);
|
||||
ac.acFanSpeed = AcStatusModel.getFanSpeed(getNextFanSpeedKey(fanSpeed));
|
||||
}
|
||||
}
|
||||
_emitAcsStatus(emit);
|
||||
} else {
|
||||
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
||||
deviceStatus.fanSpeedsString = getNextFanSpeedKey(fanSpeed);
|
||||
deviceStatus.acFanSpeed = AcStatusModel.getFanSpeed(getNextFanSpeedKey(fanSpeed));
|
||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||
}
|
||||
|
||||
await _runDeBouncerForOneDevice(
|
||||
deviceId: event.deviceId, code: 'level', value: getNextFanSpeedKey(fanSpeed));
|
||||
}
|
||||
|
||||
String getACModeString(TempModes value) {
|
||||
if (value == TempModes.cold) {
|
||||
return 'cold';
|
||||
} else if (value == TempModes.hot) {
|
||||
return 'hot';
|
||||
} else if (value == TempModes.wind) {
|
||||
return 'wind';
|
||||
} else {
|
||||
return 'cold';
|
||||
}
|
||||
}
|
||||
|
||||
void _setAllAcsTempsAndSwitches() {
|
||||
allAcsOn = true;
|
||||
allTempSame = true;
|
||||
if (deviceStatusList.isNotEmpty) {
|
||||
int temp = deviceStatusList[0].tempSet;
|
||||
deviceStatusList.firstWhere((element) {
|
||||
@@ -99,195 +303,71 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
||||
}
|
||||
}
|
||||
|
||||
void _changeAcSwitch(AcSwitch event, Emitter<AcsState> emit) async {
|
||||
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
||||
|
||||
final acSwitchValue = !event.acSwitch;
|
||||
try {
|
||||
final response = await DevicesAPI.controlDevice(
|
||||
DeviceControlModel(
|
||||
deviceId: allAcsPage ? event.deviceId : acId, code: 'switch', value: acSwitchValue),
|
||||
allAcsPage ? event.deviceId : acId);
|
||||
|
||||
if (response['success'] ?? false) {
|
||||
deviceStatus.acSwitch = acSwitchValue;
|
||||
}
|
||||
} catch (_) {}
|
||||
if (allAcsPage) {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
add(const AcsInitial(allAcs: true));
|
||||
} else {
|
||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||
_runDeBouncerForAllAcs({required String code, required dynamic value}) {
|
||||
if (_timer != null) {
|
||||
_timer!.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
void _changeAllAcSwitch(ChangeAllSwitch event, Emitter<AcsState> emit) async {
|
||||
emit(AcsLoadingState());
|
||||
try {
|
||||
_timer = Timer(const Duration(seconds: 1), () async {
|
||||
if (deviceStatusList.length == devicesList.length) {
|
||||
for (int i = 0; i < deviceStatusList.length; i++) {
|
||||
await DevicesAPI.controlDevice(
|
||||
DeviceControlModel(deviceId: devicesList[i].uuid, code: 'switch', value: event.value),
|
||||
devicesList[i].uuid ?? '');
|
||||
try {
|
||||
await DevicesAPI.controlDevice(
|
||||
DeviceControlModel(deviceId: devicesList[i].uuid, code: code, value: value),
|
||||
devicesList[i].uuid ?? '');
|
||||
} catch (_) {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
add(const AcsInitial(allAcs: true));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
add(const AcsInitial(allAcs: true));
|
||||
});
|
||||
}
|
||||
|
||||
void _increaseAllTemp(IncreaseAllTemp event, Emitter<AcsState> emit) async {
|
||||
emit(AcsLoadingState());
|
||||
try {
|
||||
double tempValue = event.value + 0.5;
|
||||
int value = (tempValue * 10).toInt();
|
||||
if (deviceStatusList.length == devicesList.length) {
|
||||
for (int i = 0; i < deviceStatusList.length; i++) {
|
||||
await DevicesAPI.controlDevice(
|
||||
DeviceControlModel(deviceId: devicesList[i].uuid, code: 'temp_set', value: value),
|
||||
devicesList[i].uuid ?? '');
|
||||
_runDeBouncerForOneDevice({
|
||||
required String deviceId,
|
||||
required String code,
|
||||
required dynamic value,
|
||||
}) {
|
||||
if (_timer != null) {
|
||||
_timer!.cancel();
|
||||
}
|
||||
_timer = Timer(const Duration(seconds: 1), () async {
|
||||
try {
|
||||
final response = await DevicesAPI.controlDevice(
|
||||
DeviceControlModel(deviceId: allAcsPage ? deviceId : acId, code: code, value: value),
|
||||
allAcsPage ? deviceId : acId);
|
||||
|
||||
if (!response['success']) {
|
||||
add(AcsInitial(allAcs: allAcsPage));
|
||||
}
|
||||
} catch (_) {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
add(AcsInitial(allAcs: allAcsPage));
|
||||
}
|
||||
} catch (_) {}
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
add(const AcsInitial(allAcs: true));
|
||||
});
|
||||
}
|
||||
|
||||
void _decreaseAllTemp(DecreaseAllTemp event, Emitter<AcsState> emit) async {
|
||||
emit(AcsLoadingState());
|
||||
try {
|
||||
double tempValue = event.value - 0.5;
|
||||
int value = (tempValue * 10).toInt();
|
||||
if (deviceStatusList.length == devicesList.length) {
|
||||
for (int i = 0; i < deviceStatusList.length; i++) {
|
||||
await DevicesAPI.controlDevice(
|
||||
DeviceControlModel(deviceId: devicesList[i].uuid, code: 'temp_set', value: value),
|
||||
devicesList[i].uuid ?? '');
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
add(const AcsInitial(allAcs: true));
|
||||
}
|
||||
|
||||
void _changeLockValue(ChangeLock event, Emitter<AcsState> emit) async {
|
||||
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
||||
|
||||
final lockValue = !event.lockBool;
|
||||
try {
|
||||
final response = await DevicesAPI.controlDevice(
|
||||
DeviceControlModel(deviceId: acId, code: 'child_lock', value: lockValue), acId);
|
||||
|
||||
if (response['success'] ?? false) {
|
||||
deviceStatus.childLock = lockValue;
|
||||
}
|
||||
} catch (_) {}
|
||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||
}
|
||||
|
||||
void _increaseCoolTo(IncreaseCoolToTemp event, Emitter<AcsState> emit) async {
|
||||
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
||||
double tempValue = event.value + 0.5;
|
||||
int value = (tempValue * 10).toInt();
|
||||
try {
|
||||
final response = await DevicesAPI.controlDevice(
|
||||
DeviceControlModel(
|
||||
deviceId: allAcsPage ? event.deviceId : acId, code: 'temp_set', value: value),
|
||||
allAcsPage ? event.deviceId : acId);
|
||||
|
||||
if (response['success'] ?? false) {
|
||||
deviceStatus.tempSet = value;
|
||||
}
|
||||
} catch (_) {}
|
||||
if (allAcsPage) {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
add(const AcsInitial(allAcs: true));
|
||||
bool _checkTemperatureValue(double value, Emitter<AcsState> emit) {
|
||||
if (value >= 20 && value <= 30) {
|
||||
return true;
|
||||
} else {
|
||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||
emit(const AcsFailedState(errorMessage: 'The temperature must be between 20 and 30'));
|
||||
emit(GetAllAcsStatusState(
|
||||
allAcsStatues: deviceStatusList,
|
||||
allAcs: devicesList,
|
||||
allOn: allAcsOn,
|
||||
allTempSame: allTempSame,
|
||||
temp: globalTemp));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void _decreaseCoolTo(DecreaseCoolToTemp event, Emitter<AcsState> emit) async {
|
||||
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
||||
|
||||
double tempValue = event.value - 0.5;
|
||||
int value = (tempValue * 10).toInt();
|
||||
try {
|
||||
final response = await DevicesAPI.controlDevice(
|
||||
DeviceControlModel(
|
||||
deviceId: allAcsPage ? event.deviceId : acId, code: 'temp_set', value: value),
|
||||
allAcsPage ? event.deviceId : acId);
|
||||
|
||||
if (response['success'] ?? false) {
|
||||
deviceStatus.tempSet = value;
|
||||
}
|
||||
} catch (_) {}
|
||||
if (allAcsPage) {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
add(const AcsInitial(allAcs: true));
|
||||
} else {
|
||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||
}
|
||||
}
|
||||
|
||||
void _changeAcMode(ChangeAcMode event, Emitter<AcsState> emit) async {
|
||||
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
||||
final tempMode = tempModesMap[getNextItem(tempModesMap, event.tempModes)]!;
|
||||
try {
|
||||
final response = await DevicesAPI.controlDevice(
|
||||
DeviceControlModel(
|
||||
deviceId: allAcsPage ? event.deviceId : acId,
|
||||
code: 'mode',
|
||||
value: getACModeString(tempMode)),
|
||||
allAcsPage ? event.deviceId : acId);
|
||||
|
||||
if (response['success'] ?? false) {
|
||||
deviceStatus.modeString = getACModeString(tempMode);
|
||||
deviceStatus.acMode = AcStatusModel.getACMode(getACModeString(tempMode));
|
||||
}
|
||||
} catch (_) {}
|
||||
if (allAcsPage) {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
add(const AcsInitial(allAcs: true));
|
||||
} else {
|
||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||
}
|
||||
}
|
||||
|
||||
void _changeFanSpeed(ChangeFanSpeed event, Emitter<AcsState> emit) async {
|
||||
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
||||
|
||||
final fanSpeed = event.fanSpeeds;
|
||||
final response = await DevicesAPI.controlDevice(
|
||||
DeviceControlModel(
|
||||
deviceId: allAcsPage ? event.deviceId : acId,
|
||||
code: 'level',
|
||||
value: getNextFanSpeedKey(fanSpeed)),
|
||||
allAcsPage ? event.deviceId : acId);
|
||||
|
||||
try {
|
||||
if (response['success'] ?? false) {
|
||||
deviceStatus.fanSpeedsString = getNextFanSpeedKey(fanSpeed);
|
||||
deviceStatus.acFanSpeed = AcStatusModel.getFanSpeed(getNextFanSpeedKey(fanSpeed));
|
||||
}
|
||||
} catch (_) {}
|
||||
if (allAcsPage) {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
add(const AcsInitial(allAcs: true));
|
||||
} else {
|
||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||
}
|
||||
}
|
||||
|
||||
String getACModeString(TempModes value) {
|
||||
if (value == TempModes.cold) {
|
||||
return 'cold';
|
||||
} else if (value == TempModes.hot) {
|
||||
return 'hot';
|
||||
} else if (value == TempModes.wind) {
|
||||
return 'wind';
|
||||
} else {
|
||||
return 'cold';
|
||||
}
|
||||
_emitAcsStatus(Emitter<AcsState> emit) {
|
||||
emit(GetAllAcsStatusState(
|
||||
allAcsStatues: deviceStatusList,
|
||||
allAcs: devicesList,
|
||||
allOn: allAcsOn,
|
||||
allTempSame: allTempSame,
|
||||
temp: globalTemp));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,11 @@ class AcsLoading extends AcsEvent {}
|
||||
class AcSwitch extends AcsEvent {
|
||||
final bool acSwitch;
|
||||
final String deviceId;
|
||||
const AcSwitch({required this.acSwitch, this.deviceId = ''});
|
||||
final String productId;
|
||||
const AcSwitch({required this.acSwitch, this.deviceId = '', this.productId = ''});
|
||||
|
||||
@override
|
||||
List<Object> get props => [acSwitch, deviceId];
|
||||
List<Object> get props => [acSwitch, deviceId, productId];
|
||||
}
|
||||
|
||||
class AcsInitial extends AcsEvent {
|
||||
@@ -31,7 +32,8 @@ class ACsChangeStatus extends AcsEvent {}
|
||||
class IncreaseCoolToTemp extends AcsEvent {
|
||||
final double value;
|
||||
final String deviceId;
|
||||
const IncreaseCoolToTemp({required this.value, this.deviceId = ''});
|
||||
final String productId;
|
||||
const IncreaseCoolToTemp({required this.value, this.deviceId = '', this.productId = ''});
|
||||
|
||||
@override
|
||||
List<Object> get props => [value, deviceId];
|
||||
@@ -40,7 +42,9 @@ class IncreaseCoolToTemp extends AcsEvent {
|
||||
class DecreaseCoolToTemp extends AcsEvent {
|
||||
final double value;
|
||||
final String deviceId;
|
||||
const DecreaseCoolToTemp({required this.value, this.deviceId = ''});
|
||||
final String productId;
|
||||
|
||||
const DecreaseCoolToTemp({required this.value, this.deviceId = '', this.productId = ''});
|
||||
|
||||
@override
|
||||
List<Object> get props => [value, deviceId];
|
||||
@@ -49,19 +53,22 @@ class DecreaseCoolToTemp extends AcsEvent {
|
||||
class ChangeAcMode extends AcsEvent {
|
||||
final TempModes tempModes;
|
||||
final String deviceId;
|
||||
const ChangeAcMode({required this.tempModes, this.deviceId = ''});
|
||||
final String productId;
|
||||
const ChangeAcMode({required this.tempModes, this.deviceId = '', this.productId = ''});
|
||||
|
||||
@override
|
||||
List<Object> get props => [tempModes, deviceId];
|
||||
List<Object> get props => [tempModes, deviceId, productId];
|
||||
}
|
||||
|
||||
class ChangeFanSpeed extends AcsEvent {
|
||||
final FanSpeeds fanSpeeds;
|
||||
final String deviceId;
|
||||
const ChangeFanSpeed({required this.fanSpeeds, this.deviceId = ''});
|
||||
final String productId;
|
||||
|
||||
const ChangeFanSpeed({required this.fanSpeeds, this.deviceId = '', this.productId = ''});
|
||||
|
||||
@override
|
||||
List<Object> get props => [fanSpeeds, deviceId];
|
||||
List<Object> get props => [fanSpeeds, deviceId, productId];
|
||||
}
|
||||
|
||||
class ChangeLock extends AcsEvent {
|
||||
|
||||
@@ -56,10 +56,10 @@ class GetAllAcsStatusState extends AcsState {
|
||||
}
|
||||
|
||||
class AcsFailedState extends AcsState {
|
||||
final String error;
|
||||
final String errorMessage;
|
||||
|
||||
const AcsFailedState({required this.error});
|
||||
const AcsFailedState({required this.errorMessage});
|
||||
|
||||
@override
|
||||
List<Object> get props => [error];
|
||||
List<Object> get props => [errorMessage];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user