This Flask application serves as an API for managing and monitoring data from sensor nodes. It provides endpoints for inserting sensor data, fetching latest data, configuring settings, managing alerts, and more.
- Python 3.x
- Flask
- Flask-CORS
- Haversine
- MySQL Connector
- Pytz
- Requests
-
Clone the repository:
git clone https://github.com/RUNG5445/Dashboard.git
-
Install dependencies:
pip install flask flask-cors haversine mysql-connector-python pytz requests
-
Configure MySQL:
Update the
db_config
andlogin_config
dictionaries in the code with your MySQL credentials. -
Run the Flask application:
python app.py
- URL:
/api/data
- Method:
POST
- Description: Inserts sensor data into the database.
- Parameters:
nodename
,temperature
,humidity
,latitude
,longitude
,speed
,ebatlvl
,gbatlvl
.
- URL:
/api/latest
- Method:
GET
- Description: Fetches the latest recorded sensor data.
- URL:
/api/showconfig
- Method:
GET
- Description: Fetches and displays the current configuration settings.
- URL:
/api/sendconfig
- Method:
POST
- Description: Sends new configuration settings.
- URL:
/api/show/today
- Method:
GET
- Description: Fetches data recorded today.
- URL:
/api/show
- Method:
GET
- Description: Fetches all recorded data.
- URL:
/api/activate
- Method:
GET
- Description: Activates or deactivates a specific node.
- URL:
/api/node
- Method:
GET
- Description: Fetches active node names.
- URL:
/api/date
- Method:
POST
- Description: Fetches data within a custom date range.
- URL:
/api/alert/changecon
- Method:
POST
- Description: Changes alert conditions.
- URL:
/api/alert/con
- Method:
GET
- Description: Fetches current alert conditions.
- URL:
/api/addemail
- Method:
POST
- Description: Adds an email address for alerts.
- URL:
/api/deleteemail
- Method:
POST
- Description: Deletes an email address for alerts.
- URL:
/api/emails
- Method:
GET
- Description: Fetches configured email addresses and delay.
This project is licensed under the MIT License.