finished the bin sensor view to display connected components for a bin
This commit is contained in:
parent
67b251d865
commit
b00f10b831
16 changed files with 983 additions and 232 deletions
|
|
@ -10,6 +10,7 @@ export class Plenum {
|
|||
public status: pond.ComponentStatus = pond.ComponentStatus.create();
|
||||
public temperature: number = -127;
|
||||
public humidity: number = 200;
|
||||
public lastReading: string = ""
|
||||
|
||||
public static create(comp: Component): Plenum {
|
||||
let my = new Plenum();
|
||||
|
|
@ -18,6 +19,9 @@ export class Plenum {
|
|||
|
||||
if (comp.status.measurement.length > 0) {
|
||||
comp.status.measurement.forEach(um => {
|
||||
if (um.timestamps[0]) {
|
||||
my.lastReading = um.timestamps[0];
|
||||
}
|
||||
if (um.values[0]) {
|
||||
if (um.type === quack.MeasurementType.MEASUREMENT_TYPE_TEMPERATURE) {
|
||||
my.temperature = or(um.values[0].values[0], -127);
|
||||
|
|
@ -41,6 +45,7 @@ export class Plenum {
|
|||
}
|
||||
my.temperature = or(temp, -1270) / 10;
|
||||
my.humidity = or(hum, 20000) / 100;
|
||||
my.lastReading = comp.status.lastMeasurement?.timestamp ?? ""
|
||||
}
|
||||
|
||||
return my;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue