Add Node and Graph classes for website functionality

This commit is contained in:
Sietse Jonker
2024-03-26 11:01:16 +01:00
parent 2221be88bf
commit 12909d3650
2 changed files with 24 additions and 21 deletions

View File

@@ -22,30 +22,24 @@ The nodes are the devices that are placed in the rooms. The nodes are used to co
```mermaid
classDiagram
Node <-- SensorNode : extends
Node <-- FeedbackNode : extends
class Node {
+nodeID
+processNodeData()
+updateNodeData()
}
```
#### Sensornode
```mermaid
classDiagram
class SensorNode extends Node {
class SensorNode {
+tempArray
+humiArray
+eco2Array
+tvocArray
}
```
#### Feedbacknode
```mermaid
classDiagram
class FeedbackNode extends Node {
class FeedbackNode {
+feedbackArray
}
```
@@ -68,19 +62,16 @@ The graphs are used to display the data from the sensors. The data is collected
### Graphs
```mermaid
```mermaid
classDiagram
liveGraph --> graph: extends
class graph {
+nodeId
makeGraph()
}
```
### Live graphs
```mermaid
classDiagram
class liveGraph extends graph {
class liveGraph {
+cnt
+timeArray
+tempArray
@@ -91,8 +82,8 @@ classDiagram
updateGraph()
updateData()
}
```
```
## Order of operations
### Live graphs
@@ -114,4 +105,16 @@ sequenceDiagram
3. The website updates the data coming from the raspberry pi on its own variables and arrays
4. The website updates the live graphs every time new data is received from the websocket
### Node
```mermaid
sequenceDiagram
participant Node
participant Raspberry pi
participant Website
Node->>Raspberry pi: node data via websocket every 5 seconds
Raspberry pi->>Website: Make a new object depending on what node it is
Website->>Website: updateNodeData()
Website->>Website: processNodeData()
```

View File

@@ -38,7 +38,7 @@ class feedbackNode extends node {
}
}
class liveGraph extends node {
class liveGraph extends graph {
// Constructor to initialize the graph
constructor(id) {
super(id);