Add node class and update liveGraph class

This commit is contained in:
Sietse Jonker
2024-03-22 11:30:04 +01:00
parent f94c452a19
commit 1982db8c50

View File

@@ -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) {