diff --git a/lib/mqttclient.ts b/lib/mqttclient.ts index 8f8530e..13e2851 100644 --- a/lib/mqttclient.ts +++ b/lib/mqttclient.ts @@ -315,7 +315,8 @@ export default class MQTTClient { }, name: obj.name, type: obj.type, - alias: alias + alias: alias, + transient: !(obj.properties?.recordToDB?.value) }; return acc; }, {})); @@ -399,6 +400,10 @@ export default class MQTTClient { writeToInfluxDB(birth, topic: Topic, value) { if (value === null) return; + if (birth.transient) { + logger.debug(`Metric ${birth.name} is transient, not writing to InfluxDB`); + return; + } // Get the value after the last / let metricName = birth.name.split('/').pop();