mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 23:44:56 +00:00
implemented ceiling and wall sensors, and bug fixes
This commit is contained in:
@ -9,17 +9,18 @@ class WallSensorModel {
|
||||
int currentDistance;
|
||||
int illuminance;
|
||||
bool indicator;
|
||||
int noBodyTime;
|
||||
|
||||
WallSensorModel({
|
||||
required this.presenceState,
|
||||
required this.farDetection,
|
||||
required this.presenceTime,
|
||||
required this.motionSensitivity,
|
||||
required this.motionlessSensitivity,
|
||||
required this.currentDistance,
|
||||
required this.illuminance,
|
||||
required this.indicator,
|
||||
});
|
||||
WallSensorModel(
|
||||
{required this.presenceState,
|
||||
required this.farDetection,
|
||||
required this.presenceTime,
|
||||
required this.motionSensitivity,
|
||||
required this.motionlessSensitivity,
|
||||
required this.currentDistance,
|
||||
required this.illuminance,
|
||||
required this.indicator,
|
||||
required this.noBodyTime});
|
||||
|
||||
factory WallSensorModel.fromJson(List<Status> jsonList) {
|
||||
late String _presenceState;
|
||||
@ -30,6 +31,7 @@ class WallSensorModel {
|
||||
late int _currentDistance;
|
||||
late int _illuminance;
|
||||
late bool _indicator;
|
||||
late int _noBodyTime;
|
||||
|
||||
for (int i = 0; i < jsonList.length; i++) {
|
||||
if (jsonList[i].code == 'presence_state') {
|
||||
@ -48,6 +50,8 @@ class WallSensorModel {
|
||||
_illuminance = jsonList[i].value ?? 0;
|
||||
} else if (jsonList[i].code == 'indicator') {
|
||||
_indicator = jsonList[i].value ?? false;
|
||||
} else if (jsonList[i].code == 'no_one_time') {
|
||||
_noBodyTime = jsonList[i].value ?? 0;
|
||||
}
|
||||
}
|
||||
return WallSensorModel(
|
||||
@ -58,6 +62,7 @@ class WallSensorModel {
|
||||
motionlessSensitivity: _motionlessSensitivity,
|
||||
currentDistance: _currentDistance,
|
||||
illuminance: _illuminance,
|
||||
indicator: _indicator);
|
||||
indicator: _indicator,
|
||||
noBodyTime: _noBodyTime);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user