From dbb1bebdd1a9168b8a19d90358b3788dac388d3b Mon Sep 17 00:00:00 2001 From: Kjell Randa Date: Mon, 5 Aug 2024 20:04:53 +0200 Subject: [PATCH] Add basement humidity --- Gulen/NodeRed/Transform_basemnt_hum.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Gulen/NodeRed/Transform_basemnt_hum.js diff --git a/Gulen/NodeRed/Transform_basemnt_hum.js b/Gulen/NodeRed/Transform_basemnt_hum.js new file mode 100644 index 0000000..98e8ff1 --- /dev/null +++ b/Gulen/NodeRed/Transform_basemnt_hum.js @@ -0,0 +1,24 @@ +let dt = new Date(msg.payload.ctime); +let topic = msg.topic; +var os = global.get('os'); +var hostname = os.hostname(); + +node.log("") +node.log(dt + " Host - " + hostname) +node.log("Topic - " + msg.topic) + +let val = msg.payload.val; + +node.log("Basement huidity=" + val + "%") + +msg = {} +msg.payload = [{ + "bsmnt_humid": val, + "time": dt.getTime() * 1000000 +}, +{ + "host": hostname, + "topic": topic +}]; + +return msg; \ No newline at end of file