This project is a Centralized Station Meteo, featuring a React frontend and a Symfony backend. The system collects environmental data from connected sensors and displays it in real-time through a web interface. It includes modules with various sensors managed by ESP32 microcontrollers, allowing users to monitor data such as air quality and temperature remotely.
- Real-time Data Visualization: View live environmental readings from MQ-135 (air quality) and BME280 (temperature, altitude, humidity, and pressure) sensors.
- ESP32 Integration: Sensors are connected to ESP32 microcontrollers, sending data to the backend via API endpoints.
- REST API with Symfony: The backend API, built with Symfony, manages data handling and ensures seamless communication between ESP32 modules and the frontend.
- Responsive Frontend in React: The frontend interface, built in React, provides a clean and intuitive layout for users to view and analyze environmental data.
- Node.js and npm (for the React frontend)
- PHP and Composer (for the Symfony backend)
- ESP32 microcontroller with MQ-135 and BME280 sensors
- Git for version control
git clone https://github.com/mohamedmaghzaoui/stationMeteo.git
cd backend
composer install
symfony serve
cd frontend
npm install
npm start
Below are the available API routes for interacting with the system:
-
POST
/users/verify
: Verifies if a user exists based on the provided email.- Body:
{ "email": "[email protected]" }
- Response:
200 OK
if user doesn't exist409 Conflict
if email already exists
- Body:
-
POST
/users
: Adds a new user.- Body:
{ "email": "[email protected]", "name": "John Doe", "lastName": "Doe", "username": "johndoe123", "password": "password123" }
- Response:
201 Created
on success.
- Body:
-
GET
/users
: Fetches all users (requires authentication).- Response:
{ "id": 1, "email": "[email protected]", "name": "John", "lastName": "Doe", "username": "johndoe123", "roles": ["ROLE_USER"] }
- Response:
-
GET
/user
: Fetches the logged-in user's data (requires authentication).- Response:
{ "id": 1, "email": "[email protected]", "name": "John", "lastName": "Doe", "username": "johndoe123", "roles": ["ROLE_USER"] }
- Response:
-
POST
/sensor
: Handles sensor data from ESP32 modules.- Body:
{ "macAddress": "ABC123", "name": "MQ-135", "temperature": 23, "pressure": 1013, "humidity": 45, "altitude": 120, "airQuality": 90, "time": "2024-11-10T10:00:00", "place": "Room 101" }
- Response:
200 OK
on success.
- Body:
-
POST
/sensors/add
: Links a sensor to a user.- Body:
{ "macAddress": "ABC123", "place": "Room 101", "name": "MQ-135" }
- Response:
200 OK
if the sensor is linked to the user.
- Body:
-
DELETE
/sensors/delete
: Unlinks a sensor from a user.- Body:
{ "macAddress": "ABC123" }
- Response:
200 OK
on success.
- Body:
-
GET
/user/sensors
: Retrieves all sensors linked to the logged-in user.- Response:
[ { "macAddress": "ABC123", "name": "MQ-135", "temperature": 23, "pressure": 1013, "humidity": 45, "altitude": 120, "airQuality": 90, "time": "2024-11-10T10:00:00", "place": "Room 101" } ]
- Response:
- 400 Bad Request: Missing required fields or invalid data.
- 401 Unauthorized: User is not authenticated.
- 404 Not Found: Resource not found (e.g., sensor or user).
- 409 Conflict: Resource already exists (e.g., user email).
The ESP32 modules continuously send sensor data to the Symfony backend. The React frontend displays this data in real-time for user analysis.
Contributions are welcome! Please feel free to submit a Pull Request.
Hi, I'm Mohamed Maghzaoui, a passionate software engineer with a wide range of expertise spanning from web development to IoT, cloud, and networking technologies. You can explore my work and projects online: