fix to send fit data to integrate with API (was true and false)now cur module send close and open with control key

This commit is contained in:
Rafeek-Khoudare
2025-06-30 08:56:42 +03:00
parent d4625a8f04
commit 0cfd58d820
2 changed files with 12 additions and 3 deletions

View File

@ -35,8 +35,8 @@ class DeviceStatus {
}
class Status {
final String code;
final dynamic value;
String code;
dynamic value;
Status({
required this.code,

View File

@ -286,11 +286,20 @@ class ScheduleBloc extends Bloc<ScheduleEvent, ScheduleState> {
try {
if (state is ScheduleLoaded) {
final dateTime = DateTime.parse(event.time);
Status status = Status(code: '', value: '');
if (event.category == 'CUR_2') {
status.code = 'control';
status.value = event.functionOn == true ? 'open' : 'close';
} else {
status.code = event.category;
status.value = event.functionOn;
}
final updatedSchedule = ScheduleEntry(
scheduleId: event.scheduleId,
category: event.category,
time: getTimeStampWithoutSeconds(dateTime).toString(),
function: Status(code: event.category, value: event.functionOn),
function: status,
// Status(code: event.category, value: event.functionOn),
days: event.selectedDays,
);
final success = await DevicesManagementApi().editScheduleRecord(