This commit is contained in:
mohammad
2024-09-26 16:36:23 +03:00
parent 4e345db842
commit 781522d4b6

View File

@ -381,14 +381,13 @@ class WaterHeaterBloc extends Bloc<WaterHeaterEvent, WaterHeaterState> {
groupTwoGangList.map((device) => device.deviceId).toList(); groupTwoGangList.map((device) => device.deviceId).toList();
final response = await DevicesAPI.deviceController( final response = await DevicesAPI.deviceController(
code: 'switch_1', code: 'switch_1',
devicesUuid: allDeviceIds, devicesUuid: [event.deviceId],
value: !event.value, value: !event.value,
); );
emit(UpdateGroupState( emit(UpdateGroupState(
twoGangList: groupTwoGangList, allSwitches: allSwitchesValue)); twoGangList: groupTwoGangList, allSwitches: allSwitchesValue));
if (!response['success']) { if (!response['success']) {
// add(InitialEvent(groupScreen: twoGangGroup)); add(InitialWizardEvent());
} }
} catch (_) { } catch (_) {
// add(InitialEvent(groupScreen: twoGangGroup)); // add(InitialEvent(groupScreen: twoGangGroup));
@ -470,12 +469,12 @@ class WaterHeaterBloc extends Bloc<WaterHeaterEvent, WaterHeaterState> {
// Check if either response is unsuccessful, then reset to initial state // Check if either response is unsuccessful, then reset to initial state
if (!response1['success'] || !response2['success']) { if (!response1['success'] || !response2['success']) {
await Future.delayed(const Duration(milliseconds: 500)); await Future.delayed(const Duration(milliseconds: 500));
// add(const InitialEvent(groupScreen: true)); add(InitialWizardEvent());
} }
} catch (_) { } catch (_) {
// In case of an error, delay and reset the screen to initial state // In case of an error, delay and reset the screen to initial state
await Future.delayed(const Duration(milliseconds: 500)); await Future.delayed(const Duration(milliseconds: 500));
// add(const InitialEvent(groupScreen: true)); add(InitialWizardEvent());
} }
} }
@ -512,12 +511,12 @@ class WaterHeaterBloc extends Bloc<WaterHeaterEvent, WaterHeaterState> {
// Check if either response is unsuccessful, then reset to initial state // Check if either response is unsuccessful, then reset to initial state
if (!response1['success'] || !response2['success']) { if (!response1['success'] || !response2['success']) {
await Future.delayed(const Duration(milliseconds: 500)); await Future.delayed(const Duration(milliseconds: 500));
// add(const InitialEvent(groupScreen: true)); add(InitialWizardEvent());
} }
} catch (_) { } catch (_) {
// In case of an error, delay and reset the screen to initial state // In case of an error, delay and reset the screen to initial state
await Future.delayed(const Duration(milliseconds: 500)); await Future.delayed(const Duration(milliseconds: 500));
// add(const InitialEvent(groupScreen: true)); add(InitialWizardEvent());
} }
} }
} }