feat: revamp sensor add flow
This commit is contained in:
@@ -2,6 +2,7 @@ class Sensor {
|
||||
const Sensor({
|
||||
required this.id,
|
||||
required this.sensorId,
|
||||
required this.confirmed,
|
||||
this.name,
|
||||
this.roomId,
|
||||
this.x,
|
||||
@@ -10,6 +11,7 @@ class Sensor {
|
||||
|
||||
final int id;
|
||||
final String sensorId; // BLE MAC / provisioning device ID
|
||||
final bool confirmed; // true once seen on MQTT
|
||||
final String? name; // human-readable label
|
||||
final int? roomId;
|
||||
final double? x; // room relative
|
||||
@@ -21,6 +23,7 @@ class Sensor {
|
||||
factory Sensor.fromJson(Map<String, dynamic> json) => Sensor(
|
||||
id: json['id'] as int,
|
||||
sensorId: json['sensor_id'] as String,
|
||||
confirmed: json['confirmed'] as bool,
|
||||
name: json['name'] as String?,
|
||||
roomId: json['room_id'] as int?,
|
||||
x: (json['x'] as num?)?.toDouble(),
|
||||
@@ -37,6 +40,7 @@ class Sensor {
|
||||
Sensor(
|
||||
id: id,
|
||||
sensorId: sensorId,
|
||||
confirmed: confirmed,
|
||||
name: name ?? this.name,
|
||||
roomId: roomId ?? this.roomId,
|
||||
x: x ?? this.x,
|
||||
|
||||
Reference in New Issue
Block a user