save temperature, humidity and pressure to nodes table
This commit is contained in:
@ -0,0 +1,4 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `nodes` ADD COLUMN `barometric_pressure` DECIMAL(65, 30) NULL,
|
||||||
|
ADD COLUMN `relative_humidity` DECIMAL(65, 30) NULL,
|
||||||
|
ADD COLUMN `temperature` DECIMAL(65, 30) NULL;
|
@ -40,6 +40,10 @@ model Node {
|
|||||||
air_util_tx Decimal?
|
air_util_tx Decimal?
|
||||||
uptime_seconds BigInt?
|
uptime_seconds BigInt?
|
||||||
|
|
||||||
|
temperature Decimal?
|
||||||
|
relative_humidity Decimal?
|
||||||
|
barometric_pressure Decimal?
|
||||||
|
|
||||||
neighbour_broadcast_interval_secs Int?
|
neighbour_broadcast_interval_secs Int?
|
||||||
neighbours Json?
|
neighbours Json?
|
||||||
neighbours_updated_at DateTime?
|
neighbours_updated_at DateTime?
|
||||||
|
@ -666,6 +666,11 @@ client.on("message", async (topic, message) => {
|
|||||||
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;
|
||||||
|
|
||||||
|
// set metrics to update on node table
|
||||||
|
data.temperature = temperature;
|
||||||
|
data.relative_humidity = relativeHumidity;
|
||||||
|
data.barometric_pressure = barometricPressure;
|
||||||
|
|
||||||
// create environment metric
|
// create environment metric
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user