fix: Sensor schema drift with upstream API

This commit is contained in:
2026-05-13 20:30:44 +02:00
parent 364a0eedf3
commit f8df267b9c
4 changed files with 6 additions and 16 deletions
+4 -8
View File
@@ -6,16 +6,14 @@ class Sensor {
this.roomId,
this.x,
this.y,
this.rssiRef,
});
final int id;
final String sensorId; // BLE MAC / provisioning device ID
final String? name; // human-readable label
final int? roomId;
final double? x; // floor_x from API
final double? y; // floor_y from API
final double? rssiRef;
final double? x; // room relative
final double? y; // room relative
bool get isPlaced => roomId != null;
String get displayName => name ?? sensorId;
@@ -25,9 +23,8 @@ class Sensor {
sensorId: json['sensor_id'] as String,
name: json['name'] as String?,
roomId: json['room_id'] as int?,
x: (json['floor_x'] as num?)?.toDouble(),
y: (json['floor_y'] as num?)?.toDouble(),
rssiRef: (json['rssi_ref'] as num?)?.toDouble(),
x: (json['x'] as num?)?.toDouble(),
y: (json['y'] as num?)?.toDouble(),
);
Sensor copyWith({
@@ -44,6 +41,5 @@ class Sensor {
roomId: roomId ?? this.roomId,
x: x ?? this.x,
y: y ?? this.y,
rssiRef: rssiRef ?? this.rssiRef,
);
}