collect wind environment metrics
This commit is contained in:
@ -0,0 +1,5 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `environment_metrics` ADD COLUMN `wind_direction` INTEGER NULL,
|
||||||
|
ADD COLUMN `wind_gust` DECIMAL(65, 30) NULL,
|
||||||
|
ADD COLUMN `wind_lull` DECIMAL(65, 30) NULL,
|
||||||
|
ADD COLUMN `wind_speed` DECIMAL(65, 30) NULL;
|
@ -133,6 +133,10 @@ model EnvironmentMetric {
|
|||||||
voltage Decimal?
|
voltage Decimal?
|
||||||
current Decimal?
|
current Decimal?
|
||||||
iaq Int?
|
iaq Int?
|
||||||
|
wind_direction Int?
|
||||||
|
wind_speed Decimal?
|
||||||
|
wind_gust Decimal?
|
||||||
|
wind_lull Decimal?
|
||||||
|
|
||||||
created_at DateTime @default(now())
|
created_at DateTime @default(now())
|
||||||
updated_at DateTime @default(now()) @updatedAt
|
updated_at DateTime @default(now()) @updatedAt
|
||||||
|
@ -1118,6 +1118,10 @@ client.on("message", async (topic, message) => {
|
|||||||
const voltage = telemetry.environmentMetrics.voltage !== 0 ? telemetry.environmentMetrics.voltage : null;
|
const voltage = telemetry.environmentMetrics.voltage !== 0 ? telemetry.environmentMetrics.voltage : null;
|
||||||
const current = telemetry.environmentMetrics.current !== 0 ? telemetry.environmentMetrics.current : null;
|
const current = telemetry.environmentMetrics.current !== 0 ? telemetry.environmentMetrics.current : null;
|
||||||
const iaq = telemetry.environmentMetrics.iaq !== 0 ? telemetry.environmentMetrics.iaq : null;
|
const iaq = telemetry.environmentMetrics.iaq !== 0 ? telemetry.environmentMetrics.iaq : null;
|
||||||
|
const windDirection = telemetry.environmentMetrics.windDirection;
|
||||||
|
const windSpeed = telemetry.environmentMetrics.windSpeed;
|
||||||
|
const windGust = telemetry.environmentMetrics.windGust;
|
||||||
|
const windLull = telemetry.environmentMetrics.windLull;
|
||||||
|
|
||||||
// set metrics to update on node table
|
// set metrics to update on node table
|
||||||
data.temperature = temperature;
|
data.temperature = temperature;
|
||||||
@ -1151,6 +1155,10 @@ client.on("message", async (topic, message) => {
|
|||||||
voltage: voltage,
|
voltage: voltage,
|
||||||
current: current,
|
current: current,
|
||||||
iaq: iaq,
|
iaq: iaq,
|
||||||
|
wind_direction: windDirection,
|
||||||
|
wind_speed: windSpeed,
|
||||||
|
wind_gust: windGust,
|
||||||
|
wind_lull: windLull,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user