2.9 KiB
2.9 KiB
Nodes
Introduction
The nodes are the devices that are placed in the rooms. The nodes are used to collect the data from the sensors. Every node is connected to the websocket, and sends their data with their mac address in json format. The websocket broadcasts the node data back to all clients, and since our website functions as a client it also receives the data. Every node will, depending on what node, be made into a class.
Requirements
Sensornode
- Every node has to have a unique nodeID
- Every node has to have their corresponding sensorsvalues in form of arrays
Feedbacknodes
- Every node has to have a unique nodeID
- Every node has to have their corresponding feedback in form of a 2D array
Class diagrams
Node
classDiagram
Node <-- SensorNode : extends
Node <-- FeedbackNode : extends
class Node {
+nodeID
+processNodeData()
+updateNodeData()
}
class SensorNode {
+tempArray
+humiArray
+eco2Array
+tvocArray
}
class FeedbackNode {
+feedbackArray
}
Graphs
Introduction
The graphs are used to display the data from the sensors. The data is collected by the raspberry pi and then displayed on the graphs. The graphs are made using the plotly library .
Requirements
Live graphs
- Every node has to have a live graph
- The graphs has to be updated every 5 seconds
- All the data from one node has to fit in one graph
Class diagrams
Graphs
classDiagram
liveGraph --> graph: extends
class graph {
+nodeId
makeGraph()
}
class liveGraph {
+cnt
+timeArray
+tempArray
+humiArray
+eco2Array
+tvocArray
makeGraph()
updateGraph()
updateData()
}
Order of operations
Live graphs
sequenceDiagram
participant Node
participant Raspberry pi
participant Website
Node->>Raspberry pi: sensordata via websocket every 5 seconds
Raspberry pi->>Website: Node data via websocket if new data is received from the node
Website->>Website: updateGraph()
Website->>Website: updateData()
- Every node sends its data to the raspberry pi via websocket every 5 seconds
- The raspberry pi sends the data to the website via websocket if new data is received from the node
- The website updates the data coming from the raspberry pi on its own variables and arrays
- The website updates the live graphs every time new data is received from the websocket
Node
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()