Framework for managing IoT devices
-
Insert data in "credentials.json"
{ "server": { "domain": "YOUR_DDNS", "port": 5000 }, "db": { "host": "YOUR_DB_HOST", "db_name": "YOUR_DB_NAME", "root_password": "YOUR_DB_ROOT_PASSWORD", "user": "YOUR_DB_USER", "user_password": "YOUR_DB_USER_PASSWORD", "port": 3307 }, "phpmyadmin": { "port": 9081 }, "email": { "address": "YOUR_EMAIL_ADDRESS", "password": "YOUR_EMAIL_PASSWORD!", "host": "smtp.gmail.com", "port": 465 } }
*You can change ports without problems there are no constraints
-
Now run "start.sh" script
*This script delete old containers, install dependencies, create .env file and build and run the docker-compose
- To update the server run "build_and_run_dockerfile.sh" script that stop and remove old container, delete old image and build and run the new image
*The DataBase and PhpMyAdmin will not be changed
-
API
Endpoint Method Description Request body Response body / GET, POST To check if server is up /signup POST To add new user JSON: { name: str, surname: str, username: str, email: str, password: str } JSON: { valid: bool, info: { api_key: str } } /otp_request POST To make otp request /login POST To log in /change_password POST To change user password /reset_password GET To reset user password /device POST To manage IoT devices -
Device action
Action Description Request body Response body create To add new device delete To delete a device change_ps_name To change name of a power strip (if exist) change_switch_name To change name of a switch of a power strip (if exist) send To send the action that the device will have to perform get To get the status of component of device
- DIY NodeMCU
- Philips Hue
- Sonoff BASICR3
- Sonoff RFR3
- Sonoff Mini