The project involves the design and development of a device that allows remote control the power supply of the connected receiver. Powering the receiver on and off should be possible on demand, after a certain period of time, during designated periods. In addition, the device will conduct measurements of voltage and current and count the energy used (Smart Socket). The second part of the project is creation of a web application to manage the device and present statistics. Communication with the device and data storage will be possible through a configured cloud service.
- TypeScript
- JavaScript
- ReactJS
- React Router
- IBM Carbon
- Axios
- Sequelize
- PostgreSQL
- Login / Create account
- Add GMS device
- Monitor devices data
- Manage devices
- Light / dark theme
The solution consists of six major components:
- IoT Device - smart device able to work in GMS. (Device)
- Azure IoT Hub - a managed cloud service that acts as a central message hub for communication between an IoT application and its attached devices.
- Azure Stream Analytics - cloud service that provides real-time analytic computations on the data streaming from IoT devices.
- Azure Database for PostgreSQL - Database used to store devices telemetry and web app data.
- Azure App Service - Web app used for device manipulation and telemetry presentation.
- Azure Storage Accounts - Web app used for device manipulation and telemetry presentation.
- Install Node.js and Docker.
- Create account on Microsoft Azure.
- Create Azure Database for Postgres, Azure IoT Hub, Azure Stream Analytics according to the instructions.
- Clone repository.
- In
szee_backend
create.env
file and fill with proper data:
NODE_ENV='dev'
APP_PORT='8000'
DB_HOST='[name].postgres.database.azure.com'
DB_PORT='5432'
DB_USER='[db_username]'
DB_PASS='[db_password]'
DB_DIALECT='postgres'
DB_NAME='[db_name]'
HASH_SALT='[salt]'
JWT_KEY='[jwt_key]'
TOKEN_EXPIRATION='2h'
IOT_HUB='https://[iot_hub_name].azure-devices.net/twins/'
API_VERSION='api-version=2020-09-30'
IOT_SAS='SharedAccessSignature sr=[iot_hub_name].azure-devices.net&[...]&skn=iothubowner'
- Open repository folder and run with
docker-compose up
.
App allows to create account. Registration form is validated. Every acction is confirmed by notification.
Main page contains statistics from all devices.
Device page shows data about all devices assigned to the account. Click
Add new
to add new device.
Device overview contains current indications and historical data.
Device overview contains current indications and historical data.
Mode tab allows to set manual, time or auto mode. In manual mode power supply in Smart Socket can be manually switched on or off.
In time mode device will turn on or off after declared time.
In auto mode user create device work schedule by creating up to 21 rules.
Settings allows to change device name, set data displayed on device (two of: date and time, voltage and current, power, power consumption), adjust display brightness, set first day of period and enable or disable auto resetter.
After device unlink all historical telemetry data will be removed and it will be possible to assign it to other account.