mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 15:17:55 +00:00
water heater and timer and schedule ui and api ,
Circulate ui and Inching ui
This commit is contained in:
@@ -0,0 +1,141 @@
|
||||
//
|
||||
//
|
||||
// import 'package:syncrow_app/features/devices/model/status_model.dart';
|
||||
//
|
||||
// class WHModel {
|
||||
// final int activeTime;
|
||||
// final String category;
|
||||
// final String categoryName;
|
||||
// final int createTime;
|
||||
// final String gatewayId;
|
||||
// final String icon;
|
||||
// final String ip;
|
||||
// final String lat;
|
||||
// final String lon;
|
||||
// final String localKey;
|
||||
// final String model;
|
||||
// final String name;
|
||||
// final String nodeId;
|
||||
// final bool online;
|
||||
// final String ownerId;
|
||||
// final bool sub;
|
||||
// final String timeZone;
|
||||
// final int updateTime;
|
||||
// final String uuid;
|
||||
// final String productUuid;
|
||||
// final String productType;
|
||||
// final String permissionType;
|
||||
//
|
||||
// WHModel({
|
||||
// required this.activeTime,
|
||||
// required this.category,
|
||||
// required this.categoryName,
|
||||
// required this.createTime,
|
||||
// required this.gatewayId,
|
||||
// required this.icon,
|
||||
// required this.ip,
|
||||
// required this.lat,
|
||||
// required this.lon,
|
||||
// required this.localKey,
|
||||
// required this.model,
|
||||
// required this.name,
|
||||
// required this.nodeId,
|
||||
// required this.online,
|
||||
// required this.ownerId,
|
||||
// required this.sub,
|
||||
// required this.timeZone,
|
||||
// required this.updateTime,
|
||||
// required this.uuid,
|
||||
// required this.productUuid,
|
||||
// required this.productType,
|
||||
// required this.permissionType,
|
||||
// });
|
||||
//
|
||||
// // Factory method to create a SmartDevice object from JSON
|
||||
// factory WHModel.fromJson(Map<String, dynamic> json, List<StatusModel> statusModelList) {
|
||||
// return WHModel(
|
||||
// activeTime: json['activeTime'],
|
||||
// category: json['category'],
|
||||
// categoryName: json['categoryName'],
|
||||
// createTime: json['createTime'],
|
||||
// gatewayId: json['gatewayId'],
|
||||
// icon: json['icon'],
|
||||
// ip: json['ip'],
|
||||
// lat: json['lat'],
|
||||
// lon: json['lon'],
|
||||
// localKey: json['localKey'],
|
||||
// model: json['model'],
|
||||
// name: json['name'],
|
||||
// nodeId: json['nodeId'],
|
||||
// online: json['online'],
|
||||
// ownerId: json['ownerId'],
|
||||
// sub: json['sub'],
|
||||
// timeZone: json['timeZone'],
|
||||
// updateTime: json['updateTime'],
|
||||
// uuid: json['uuid'],
|
||||
// productUuid: json['productUuid'],
|
||||
// productType: json['productType'],
|
||||
// permissionType: json['permissionType'],
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// // Method to convert SmartDevice object to JSON
|
||||
// Map<String, dynamic> toJson() {
|
||||
// return {
|
||||
// 'activeTime': activeTime,
|
||||
// 'category': category,
|
||||
// 'categoryName': categoryName,
|
||||
// 'createTime': createTime,
|
||||
// 'gatewayId': gatewayId,
|
||||
// 'icon': icon,
|
||||
// 'ip': ip,
|
||||
// 'lat': lat,
|
||||
// 'lon': lon,
|
||||
// 'localKey': localKey,
|
||||
// 'model': model,
|
||||
// 'name': name,
|
||||
// 'nodeId': nodeId,
|
||||
// 'online': online,
|
||||
// 'ownerId': ownerId,
|
||||
// 'sub': sub,
|
||||
// 'timeZone': timeZone,
|
||||
// 'updateTime': updateTime,
|
||||
// 'uuid': uuid,
|
||||
// 'productUuid': productUuid,
|
||||
// 'productType': productType,
|
||||
// 'permissionType': permissionType,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
import 'package:syncrow_app/features/devices/model/status_model.dart';
|
||||
|
||||
class WHModel {
|
||||
bool firstSwitch;
|
||||
int firstCountDown;
|
||||
|
||||
WHModel(
|
||||
{required this.firstSwitch,
|
||||
required this.firstCountDown,
|
||||
});
|
||||
|
||||
factory WHModel.fromJson(List<StatusModel> jsonList) {
|
||||
late bool _switch;
|
||||
late int _count;
|
||||
|
||||
|
||||
for (int i = 0; i < jsonList.length; i++) {
|
||||
if (jsonList[i].code == 'switch_1') {
|
||||
_switch = jsonList[i].value ?? false;
|
||||
} else if (jsonList[i].code == 'countdown_1') {
|
||||
_count = jsonList[i].value ?? 0;
|
||||
}
|
||||
}
|
||||
return WHModel(
|
||||
firstSwitch: _switch,
|
||||
firstCountDown: _count,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user