LabPowerUI-Server is a RESTful API for controlling and monitoring lab power supplies such as the Owon SPE6103 and SPE3103, as well as Kiprim DC310S and DC605S models. It provides endpoints for adjusting voltage, current, and power limits, retrieving real-time data, and managing storage settings.
- Control and monitor supported lab power supplies
- Store power supply data in Redis
- Adjustable data storage interval and limits
- Support for fake values for testing purposes
- Logging system for debugging
- OpenAPI (Swagger) documentation
To deploy the LabPowerUI-Server along with Redis and the LabPowerUI frontend, use the following docker-compose.yml setup:
version: "3"
services:
power-supply-server:
image: badsmoke/labpowerui-server
ports:
- "1234:1234"
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_DB=0
- USB_DEVICE=/dev/ttyUSB0
- STORAGE_TASK=true
- STORAGE_INTERVAL=1
- STORAGE_LIMIT=10000
- FAKE_VALUES=false
- LOGGING=false
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
restart: always
redis:
image: redis:7-alpine
restart: always
ports:
- "6379:6379"
power-supply-ui:
image: badsmoke/labpowerui
ports:
- "80:80"If you prefer running the server locally without Docker, follow these steps:
git clone https://github.com/badsmoke/LabPowerUI-Server.git
cd LabPowerUI-Server
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
pip install -r requirements.txt
python src/main.pyThe API follows OpenAPI standards and provides a Swagger UI at:
http://localhost:1234/api/docs
GET /api/storage/data?limit=1Response:
{
"status": "success",
"code": 200,
"message": "Power supply data retrieved successfully",
"time": "47:57:238633",
"device": "fake psu",
"data": {
"readingVoltage": 1.7,
"readingCurrent": 0.7,
"voltage": 19,
"current": 5,
"voltageLimit": 30,
"currentLimit": 8,
"power": 1.19,
"output_status": true
}
}POST /api/set/output
Content-Type: application/json
{
"output": true
}POST /api/logging
Content-Type: application/json
{
"logging": true
}Full API documentation is available in the swagger.yaml file.
The following environment variables can be set:
| Variable | Description | Default Value |
|---|---|---|
| REDIS_HOST | Redis server hostname | redis |
| REDIS_PORT | Redis port | 6379 |
| REDIS_DB | Redis database index | 0 |
| USB_DEVICE | USB device path for PSU | /dev/ttyUSB0 |
| STORAGE_TASK | Enable data storage (true/false) | true |
| STORAGE_INTERVAL | Interval for storing data (sec) | 1 |
| STORAGE_LIMIT | Max number of stored entries | 10000 |
| FAKE_VALUES | Use fake PSU values (true/false) | false |
| LOGGING | Enable logging (true/false) | true |
LabPowerUI-Server is built with:
- owon-psu-control – Python library for communicating with supported power supplies
- Flask – API framework
- Redis – Storage for logging and historical data
The LabPowerUI-Server is designed to work with the LabPowerUI web frontend. It provides an easy-to-use interface for monitoring and controlling your power supply unit.
This project is licensed under the MIT License.
- @badsmoke
For issues or contributions, open an issue in the repository or reach out via email.


