Add node class and update liveGraph class
This commit is contained in:
@@ -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 {
|
class liveGraph {
|
||||||
// Constructor to initialize the graph
|
// Constructor to initialize the graph
|
||||||
constructor(id) {
|
constructor(id) {
|
||||||
|
Reference in New Issue
Block a user