fix: Sensor schema drift with upstream API
This commit is contained in:
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user