EcoLab Dashboard - DTEDI Electronics Laboratory Internship 2025 x Final Project
Author: Stephanus Kevin Andika Rata
EcoLab Dashboard is a Smart Laboratory Management System desktop application built with PySide6 (Qt) and Firebase Authentication to monitor and control laboratory devices in real time.
The system currently supports:
- EcoLab Power Monitoring (Growatt)
- Smart Socket
- Smart Lamp
- Smart AC Control
- Weather Station Monitoring
- Laboratory sensor and device status monitoring
- Firebase Authentication: email/password, Google Sign-In, and Guest Mode
- Role-based Access Control: guest, user, and admin
- Session Management: remember-me support
- Admin Panel: laboratory user account management
- Smart Socket Control: relay, timer, schedule, and energy monitoring
- Smart Socket Safety Protection: load warning, overload popup, and automatic cutoff
- Smart Socket Power-Off Protection: admin-configured blocked/password mode with Firebase sync
- Smart Socket Recording: store monitoring data in application memory
- Smart Socket Export: export per-socket data to CSV
- Smart Socket Graph: per-socket monitoring charts inside the control popup
- EcoLab Power Monitoring: Growatt inverter monitoring on page 1
- Weather Station Monitoring: laboratory weather data monitoring
- Smart Lamp Control
- Smart AC Control
- Windows 11 Dark Mode Handling: light theme enforcement for key widgets
- PySide6 (Qt6)
- Python 3.10+
- PySide6.QtCharts for Smart Socket charts
- Firebase Authentication
- Pyrebase4
- MQTT (
paho-mqtt) for IoT device communication - Growatt data integration for inverter monitoring
- Weather data integration for Weather Station monitoring
- Google Cloud / OAuth config for Google login
- Growatt Inverter for EcoLab Power Monitoring
- ESP32-C3 for Smart Socket
- Wemos D1 Mini for Smart Lamp and Smart AC
- PZEM-004T v3.0 for Smart Socket energy monitoring
- DS1302 RTC for Smart Socket timer and schedule
Python 3.10 or higherpip install -r requirements.txtThe application needs four external setup areas:
- Firebase web configuration in
.env - Google OAuth client credential in
credentials/client_secret.json - MQTT TLS certificate in
credentials/ca.crtorcredentials/ca2.crt - Growatt account credential in
.env
See credentials/README.md for the detailed credential guide.
- Create or open the EcoLab project in Firebase Console.
- Enable Authentication for Email/Password.
- Enable Google Sign-In in Firebase Authentication if you want Google login.
- Copy the Firebase web app values into the root
.envfile. - Generate a service account key and place it in
credentials/firebase_service_account.json.
Example Firebase web config values:
{
"apiKey": "YOUR_API_KEY",
"authDomain": "YOUR_PROJECT.firebaseapp.com",
"databaseURL": "https://YOUR_PROJECT.firebaseio.com",
"projectId": "YOUR_PROJECT_ID",
"storageBucket": "YOUR_PROJECT.appspot.com",
"messagingSenderId": "YOUR_SENDER_ID",
"appId": "YOUR_APP_ID"
}Required .env keys:
ECOLAB_FIREBASE_API_KEY=
ECOLAB_FIREBASE_AUTH_DOMAIN=
ECOLAB_FIREBASE_DATABASE_URL=
ECOLAB_FIREBASE_PROJECT_ID=
ECOLAB_FIREBASE_STORAGE_BUCKET=
ECOLAB_FIREBASE_MESSAGING_SENDER_ID=
ECOLAB_FIREBASE_APP_ID=
ECOLAB_FIREBASE_SERVICE_ACCOUNT=Notes:
- Leave
ECOLAB_FIREBASE_SERVICE_ACCOUNTempty if you usecredentials/firebase_service_account.json. - Fill
ECOLAB_FIREBASE_SERVICE_ACCOUNTonly if the service account file is stored somewhere else.
Google Sign-In does not use only Firebase settings. It also needs a Google OAuth client JSON file.
Prepare:
credentials/client_secret.json
Steps:
- Open Google Cloud Console.
- Select the same Google Cloud project linked to EcoLab.
- Go to
APIs & Services->Credentials. - Create or open the OAuth client used by the app.
- Download the client JSON.
- Rename it to
client_secret.json. - Place it inside the
credentials/folder.
If Google Sign-In fails, the first thing to verify is whether credentials/client_secret.json matches the active Google Cloud project.
MQTT communication for the IoT devices uses TLS and requires a CA certificate file.
Prepare:
credentials/ca.crtas the default CA certificatecredentials/ca2.crtas an optional backup CA certificate for some simulator or broker setups
Required .env keys:
ECOLAB_MQTT_BROKER=
ECOLAB_MQTT_PORT=8883
ECOLAB_MQTT_USERNAME=
ECOLAB_MQTT_PASSWORD=
ECOLAB_MQTT_CA_CERT=credentials/ca.crt
ECOLAB_MQTT_USE_TLS=trueWhat to prepare for MQTT TLS:
- MQTT broker hostname or IP
- MQTT username and password
- TLS-enabled MQTT port, usually
8883 - CA certificate file, usually
credentials/ca.crt - Fallback CA certificate if your simulator or broker setup uses
ca2.crt
Notes:
main.pydefaults tocredentials/ca.crtwhenECOLAB_MQTT_CA_CERTis not overridden.- Some simulator files in
hardware_TA/still point toca2.crt, so keep both certificate files available unless you are standardizing them. - Do not embed certificate contents directly into the firmware.
Dashboard startup currently initializes the Growatt panel during MainWindow creation, so these .env keys are required when opening the dashboard:
ECOLAB_GROWATT_USERNAME=
ECOLAB_GROWATT_PASSWORD=Notes:
- Use the same Growatt account that has access to the target storage/inverter plant.
- If the account has no accessible plant or storage device, the Growatt panel will fail during startup.
Before running the app, make sure these files exist:
.env
credentials/client_secret.json
credentials/firebase_service_account.json
credentials/ca.crt
Optional but recommended:
credentials/ca2.crt
Minimum required .env groups for a full dashboard launch:
- Firebase web config keys
- MQTT connection keys
- Growatt account keys
python launcher.py- Email Login
Sign in with email and password. - Google Sign-In
Sign in with a Google account. - Guest Mode
Read-only access without device control.
| Role | Access |
|---|---|
| Guest | Monitoring only, without device control |
| User | Device control and main dashboard access |
| Admin | All user features plus the admin panel |
The current Smart Socket feature set includes:
- Per-socket relay ON/OFF control
- Per-socket timer
- Start/stop schedules with daily and onetime modes
- Monitoring for Voltage, Current, Power, Energy, Frequency, PF
- Control popup with Control, Data, Graph, Warning, and Setting tabs
- Per-socket monitoring data recording
- Configurable recording interval from the popup
- Follow Schedule option to automatically start recording when a schedule becomes active
- Autosave CSV when schedule-based recording ends
- Load warning levels for elevated, high, and critical current
- Light warning popup for elevated load with cooldown control
- Critical overload protection with user response popup, grace period, and automatic relay cutoff
- Automatic schedule clearing before forced OFF when overload protection is triggered during an active schedule
- Admin-only Smart Socket Setting tab inside the popup to configure power-off protection per socket
- Power-off protection modes: Blocked and Password required
- Protection configuration stored in Firebase Realtime Database so it can be shared across multiple PCs
- Per-socket CSV export
- Per-socket charts with selectable metrics
- Table and chart refresh only while recording is active
Implementation notes:
- The Python Smart Socket simulator has been aligned with the latest firmware concept.
- Firmware files from
smartsocket2.inotosmartsocket5.inowere derived fromsmartsocket.inowith adjusted MQTT topics.
The current project structure after refactoring is:
Aplikasi EcoLab - New/
|-- launcher.py
|-- loginmain.py
|-- main.py
|-- create_admin.py
|-- README.md
|-- requirements.txt
|-- build.bat
|-- .env.example
|-- auth/
| |-- auth_service.py
| `-- session_manager.py
|-- config/
| |-- firebase_settings.py
| |-- login_settings.py
| `-- path_utils.py
|-- dialogs/
| |-- admin_window.py
| `-- smartsocket_popup.py
|-- services/
| |-- smartsocket_recorder.py
| |-- smartsocket_protection_store.py
| `-- smartsocket_settings_manager.py
|-- app/
| `-- setup/
| |-- ac_setup.py
| |-- arrow_setup.py
| |-- lamp_setup.py
| |-- smartsocket_setup.py
| `-- switch_setup.py
|-- backend/
| |-- mqtt_client.py
| |-- mqtt_dht22_backend.py
| |-- mcu_status_backend.py
| |-- smartsocket_backend.py
| |-- lampbutton_backend.py
| |-- acbutton_backend.py
| |-- growatt_backend.py
| |-- growatt_worker.py
| `-- weathercloud_backend.py
|-- widgets/
| |-- ac_button.py
| |-- flow_arrow.py
| |-- lamp_button.py
| `-- switch_button.py
|-- ui/
| |-- ui_functions.py
| |-- ui_theme_helper.py
| |-- ui_loginpage.py
| |-- ui_mainwindow.py
| |-- ui_adminpanel.py
| |-- ui_role_selection.py
| `-- ui_smartsocket_popup.py
|-- credentials/
|-- file ui/
|-- icon/
|-- images/
|-- hardware_TA/
`-- resources_rc.py
launcher.pyis the main application entry point.- It loads any saved session through
auth/session_manager.py. - If a valid session exists, it opens the main dashboard.
- Otherwise, it opens
loginmain.py.
auth/auth_service.pyhandles Firebase authentication and user records.auth/session_manager.pystores the local session file used by remember-me behavior.create_admin.pyis a helper script for manually creating the first admin account.
main.pycontains the main dashboard window and top-level application orchestration.loginmain.pyhandles login, sign-up, forgot password, guest mode, and the admin/dashboard selection flow.dialogs/admin_window.pycontains the admin panel.dialogs/smartsocket_popup.pycontains the detailed Smart Socket control and monitoring popup.services/smartsocket_protection_store.pystores Smart Socket power-off protection data in Firebase Realtime Database.
The app/setup/ modules are thin UI wiring helpers:
lamp_setup.pycreates and connects custom lamp buttonsswitch_setup.pycreates and connects Smart Socket switch buttonsac_setup.pycreates and connects the custom AC buttonarrow_setup.pycreates and stores flow arrowssmartsocket_setup.pyconnects Smart Socket backend signals to the main window
The backend/ folder contains service and integration modules:
mqtt_client.pymanages the shared MQTT connectionmqtt_dht22_backend.pystores and filters DHT22 sensor messagesmcu_status_backend.pytracks MCU online/offline statesmartsocket_backend.pyhandles MQTT topics for all Smart Socket deviceslampbutton_backend.pyandacbutton_backend.pysend control commandsgrowatt_backend.pyfetches inverter datagrowatt_worker.pyruns Growatt fetches outside the UI threadweathercloud_backend.pyfetches weather station data
ui/contains helper code and generated Python modules from Qt Designer.uifileswidgets/contains handwritten custom widgets used by the dashboardresources_rc.pycontains the compiled Qt resource bindings
The hardware_TA/ folder contains firmware and simulators used for development and device integration testing.
- smartsocket.ino - Smart Socket 1 firmware based on MQTT
- smartsocket2.ino - Smart Socket 2 firmware based on MQTT
- smartsocket3.ino - Smart Socket 3 firmware based on MQTT
- smartsocket4.ino - Smart Socket 4 firmware based on MQTT
- smartsocket5.ino - Smart Socket 5 firmware based on MQTT
- smartlampcontrol.ino - Smart Lamp firmware
- smartaccontrol.ino - Smart AC Control firmware
- smartsocket_simulator.py - Smart Socket 1 simulator
- smartsocket2_simulator.py - Smart Socket 2 simulator
- smartsocket3_simulator.py - Smart Socket 3 simulator
- smartsocket4_simulator.py - Smart Socket 4 simulator
- smartsocket5_simulator.py - Smart Socket 5 simulator
- mcua_simulator.py - MCU-A simulator
- mcub_simulator.py - MCU-B simulator
cd hardware_TA
python smartsocket_simulator.py- Save login sessions
- Remember-me support
- Auto-login when the session is still valid
- Application logout
- View user list
- Approve accounts
- Update user/admin roles
- Block/unblock accounts
- Update passwords for non-Google users
- Delete accounts
- Device status monitoring
- Relay control
- Countdown timer
- Automatic scheduling
- Real-time energy monitoring
- Multi-level current warning system
- Automatic overload cutoff for critical current conditions
- Admin-only power-off protection settings inside the Smart Socket popup
- Power-off protection synced through Firebase so the same socket rules can be read from different PCs
- Data recording, CSV export, and charts
- Laboratory lamp control
- MQTT-based switching
- Supports multiple lamp channels in the control room page
- Developed together with Ilham Purnomo
- IR-based AC control
- Cooling and fan modes
- Temperature settings
- Developed together with Ilham Purnomo
- Displays Growatt inverter data on page 1
- EcoLab power summary and live monitoring
- Serves as the main laboratory energy monitoring page
- Displays laboratory weather station data
- Environmental sensor monitoring on the dashboard
- Integrated into the monitoring page for surrounding condition tracking
launcher.py -> check session
|- valid session -> open dashboard
|- no session -> open login window
|- email/password -> Firebase -> save session -> dashboard
|- Google sign-in -> OAuth -> save session -> dashboard
|- guest mode -> temp session -> dashboard (limited)
- Use
launcher.pyas the main application entry point. - The local session file is created automatically after a successful login.
- Firebase credential files are not included in the repository.
- Several key widgets are forced into a light theme to avoid text color issues on Windows 11 dark mode.
- Smart Socket MQTT firmware no longer stores the CA certificate contents directly inside the
.inofiles.
Stephanus Kevin Andika Rata
DTEDI Electronics Laboratory Internship 2025
Final Project - EcoLab Smart Laboratory
DTEDI Electronics Laboratory
Universitas Gadjah Mada
Email: kevinandika18@gmail.com
Copyright (c) 2026 Stephanus Kevin Andika Rata
This project was developed as part of:
- DTEDI Electronics Laboratory Internship 2025
- Final Project / Tugas Akhir
- Universitas Gadjah Mada
This software is distributed under the terms in LICENSE_AGREEMENT.txt. All rights not expressly granted in that agreement are reserved.