implemented ceiling and wall sensors, and bug fixes

This commit is contained in:
Abdullah Alassaf
2024-08-26 15:35:18 +03:00
parent 929b72d11a
commit afee0eb5b1
98 changed files with 920 additions and 671 deletions

View File

@ -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);
}
}