mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-12-02 01:04:58 +00:00
built 3 gang switch View
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/function_model.dart';
|
||||
|
||||
class ACModel extends DeviceModel {
|
||||
late double temperature;
|
||||
@ -23,6 +24,7 @@ class ACModel extends DeviceModel {
|
||||
required super.status,
|
||||
required super.image,
|
||||
required super.timer,
|
||||
required super.functions,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
@ -40,6 +42,12 @@ class ACModel extends DeviceModel {
|
||||
}
|
||||
|
||||
factory ACModel.fromJson(Map<String, dynamic> json) {
|
||||
List<FunctionModel> func = [];
|
||||
if (json['functions'] != null) {
|
||||
json['functions'].forEach((v) {
|
||||
func.add(FunctionModel.fromJson(v));
|
||||
});
|
||||
}
|
||||
return ACModel(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
@ -52,6 +60,7 @@ class ACModel extends DeviceModel {
|
||||
timer: json['timer'],
|
||||
coolTo: json['coolTo'],
|
||||
bounds: Bounds.fromJson(json['bounds']),
|
||||
functions: func,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user