diff --git a/docs/rpi-documentation/websockets.md b/docs/rpi-documentation/websockets.md index 96cc060..d6636f6 100644 --- a/docs/rpi-documentation/websockets.md +++ b/docs/rpi-documentation/websockets.md @@ -21,9 +21,8 @@ For the websockets we are going to use 2 classes. One for the nodes and one for ``` mermaid classDiagram -client --> Website : website client +client --> User : website client client --> Node : esp32 client -Website --> Node : settings namespace raspberry pi clients { class client { @@ -42,7 +41,7 @@ namespace raspberry pi clients { updateData(data) } - class Website { + class User { +userName +password changeNodeName(data) @@ -50,6 +49,38 @@ namespace raspberry pi clients { } ``` +Code of the classes: + +``` python +class client: + def __init__(self, macAdress): + self.macAdress = macAdress + +class node(client): + def __init__(self, name, node, temperature, humidity, eCO2, TVOC, sound): + super().__init__(macAdress) + self.nodeNumber = node + self.temperature = temperature + self.humidity = humidity + self.eCO2 = eCO2 + self.TVOC = TVOC + self.sound = sound + self.name = name + + def updateData(self, temperature, humidity, eCO2, TVOC, sound): + self.temperature = temperature + self.humidity = humidity + self.eCO2 = eCO2 + self.TVOC = TVOC + self.sound = sound + +class Website(client): + def __init__(self, macAdress, user, password): + super().__init__(macAdress) + self.passWord = passWord + self.userName = userName +``` + #### Sources: * https://websockets.readthedocs.io/en/stable/index.html