From 1982db8c50f7f4c195cc9980947bb6194b86a661 Mon Sep 17 00:00:00 2001 From: Sietse Jonker Date: Fri, 22 Mar 2024 11:30:04 +0100 Subject: [PATCH] Add node class and update liveGraph class --- web/classes.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/web/classes.js b/web/classes.js index 2067bfc..49fae13 100644 --- a/web/classes.js +++ b/web/classes.js @@ -1,3 +1,26 @@ +class node { + // Constructor to initialize the node + constructor(nodeId) { + this.nodeId = nodeId; + this.temperature = 0; + this.humidity = 0; + this.eCO2 = 0; + this.TVOC = 0; + this.connected = false; + } + // Function to update the data + updateData(temperature, humidity, eCO2, TVOC) { + this.temperature = temperature; + this.humidity = humidity; + this.eCO2 = eCO2; + this.TVOC = TVOC; + } + // Function to update the connection status + updateConnection(status) { + this.connected = status; + } +} + class liveGraph { // Constructor to initialize the graph constructor(id) {