This software simulates a device equipped with a temperature sensor that controls a roof vent in a greenhouse environment. It operates through a broker-client architecture, where the simulated device communicates with a broker. The client, in turn, interacts with the vent, via the broker, managing its operations based on temperature readings received from the device. Additionally, the system provides real-time temperature data in Celsius (°C) to monitor the greenhouse environment effectively. The device communicates with the broker via TCP/IP using sockets, while the broker communicates with the client via RESTFUL. The device oscillates between 17ºC and 32°C at a rate of 0.1°C/s. When the vent is "Closed" the temperature begin to rise at a rate of 0.1°C/s and when the vent is "Opened" the opposite.
- Description
- Requirements
- Docker Installation
- How to set up
- How to Run the Application
- Images
- Final Analysis
- Additional research material used in this project
- Docker installed
This guide provides instructions on how to install Docker on different operating systems.
1. Open a terminal.
2. Run the following commands:
```bash
sudo apt-get update
sudo apt-get install docker.io
sudo systemctl start docker
sudo systemctl enable docker
docker --version
1. Download the Docker Desktop installer for Windows from the Official Docker Website: Docker Desktop for Windows
2. Run the downloaded installer and follow the on-screen instructions.
3. After installation, Docker Desktop will start automatically. Wait until Docker Desktop is fully initialized.
4. Verify if the installation was successful by opening PowerShell or CMD and running:
docker --version
1. Download the Docker Desktop installer for macOS from the Official Docker Website: Docker Desktop for Mac
2. Open the downloaded .dmg file.
3. Drag the Docker icon to the Applications folder.
4. Open Docker from Launchpad or Finder.
5. Docker will start and will be available in the menu bar. Wait until Docker is fully initialized.
6. Verify if the installation was successful by opening the terminal and running:
docker --version
This guide provides instructions on how to set the server, the device and the client. This has to be done in this order.
1. git clone https://github.com/alexsami-lopes/Networking-Project-1.git
2. cd Networking-Project-1/server
3. docker build -t server .
4. docker container run -it --network host server
1. git clone https://github.com/alexsami-lopes/Networking-Project-1.git
2. cd Networking-Project-1/device
3. docker build -t device .
4. docker container run -it --network host device
1. git clone https://github.com/alexsami-lopes/Networking-Project-1.git
2. cd Networking-Project-1/client
3. docker build -t meu-nginx .
4. docker run -d -p 8080:80 meu-nginx
This guide provides instructions on how to run the application to retrieve data from the device through the server
1. http://localhost:8080/client.html
On the "Endereço IP e Porta do Servidor (IP:Porta)" box copy and past the address of the server Flask given to you in your server terminal (in port 9000) as seen on the Image of the Server in use in use, example:
1. 172.16.103.8:9000
On the "IP do Dispositivo (IPv4)" box copy and past the address of the device given to you in your device terminal (without port) as seen on the Image of the Device in use in use, example:
1. 172.16.103.9
Click on "Solicitar Temperatura" and other butons and wait a few seconds to receive data from the device
Image of the Client GUI in use
Images showing the server, device and client being used.
The objective of this project was achieved! I've learned how to use sockets to communicate using TCP and UDP connections, as well as using Flask to make a RESTFUL communication between a client and a server and how to create a broker-client architecture.



