finished the bin sensor view to display connected components for a bin

This commit is contained in:
csawatzky 2026-05-28 11:18:40 -06:00
parent 67b251d865
commit b00f10b831
16 changed files with 983 additions and 232 deletions

View file

@ -10,6 +10,7 @@ export class Ambient {
public status: pond.ComponentStatus = pond.ComponentStatus.create();
public temperature: number = -127;
public humidity: number = 200;
public lastReading: string = ""
public static create(comp: Component): Ambient {
let my = new Ambient();
@ -18,6 +19,9 @@ export class Ambient {
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);
@ -39,6 +43,7 @@ export class Ambient {
hum = humAndTemp["relativeHumidityTimes100"];
}
}
my.lastReading = comp.status.lastMeasurement?.timestamp ?? ""
my.temperature = or(temp, -1270) / 10;
my.humidity = or(hum, 20000) / 100;
}