Control ZSPDU smart power distribution unit via serial port
Project description
zspdu
zspdu is a Python package and Robot Framework library for controlling Smart PDUs (Power Distribution Units) via USB serial interfaces. It provides both a command‑line interface (CLI) and Robot Framework keywords for automation.
Features
- List available serial ports
- Open and switch between ports
- Turn individual sockets ON/OFF
- Turn all sockets ON/OFF
- Read current measurements
- Close connections
- Usable as:
- CLI tool (
zspdu) - Robot Framework library (
Library zspdu)
- CLI tool (
Installation
Clone the repository and install in editable mode:
git clone https://github.com/ganesanluna/zspdu.git cd zspdu pip install -e .
This will install the package and register the zspdu CLI command.
Command Line Usage
zspdu -l # List all available serial ports zspdu -o /dev/ttyUSB0 # Open specific port zspdu -s /dev/ttyUSB1 # Switch to another port zspdu --on 3 # Turn ON socket 3 zspdu --off 2 # Turn OFF socket 2 zspdu --on-all # Turn ON all sockets zspdu --off-all # Turn OFF all sockets zspdu -c # Close current port zspdu -v # Show version
Running zspdu without arguments will display the help message.
Robot Framework Usage
Import the library in your .robot test file:
*** Settings ***
Library zspdu
*** Test Cases ***
Control PDU
Turn Socket On 1
${current}= Read Current
Log Current reading: ${current}
Turn Socket Off 1
Close PDU Connection
You can also pass arguments when importing:
*** Settings ***
Library zspdu port=/dev/ttyUSB1 baudrate=9600 sockets=4
Device Information (from ZS12x0 USB PDU)
Variants
- ZS1220: 8‑port USB PDU (Part Number: ZS-PDU8-USB-P1B)
Specifications
- Output Power Sockets: 8
- Power Supply: 240VAC, 15A
- Fuse Rating: 15A
- Max Current per Socket: 13A
- Total Load Capacity: 3kVA
- Relay Switching Life Expectancy: 50,000 cycles
- Current Sensing Range: up to 15A
- Control Port: USB2.0 Type‑B
Serial Port Settings
- Baud Rate: 115200
- Data Bits: 8
- Stop Bit: 1
- Parity: None
- Flow Control: None
Usage: Command line options
$ zspdu --help
usage: zspdu [-h] [-v] [-l | -o PORT | -s PORT | --on SOCKET | --off SOCKET | --on-all | --off-all | -c]
Smart PDU control via serial interface
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-l, --list List all available serial ports
-o PORT, --open PORT Open specific serial port
-s PORT, --switch PORT
Switch to another serial port
--on SOCKET Turn ON specific power socket
--off SOCKET Turn OFF specific power socket
--on-all Turn ON all power sockets
--off-all Turn OFF all power sockets
-c, --close Close current port
Current version 1.0.0, this software version supported only for linux and supported single pdu support with default port /dev/ttyUSB0.
Development
Folder structure:
.
├── src/
│ └── zspdu/
│ ├── __init__.py
│ ├── core.py
│ ├── utils.py
│ └── cli.py
├── LICENSE
├── README.md
├── pyproject.toml
├── requirements.txt
└── setup.py
License
MIT License
Copyright (c) 2026 Ganesan Selvaraj
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub-license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zspdu-0.0.1.tar.gz.
File metadata
- Download URL: zspdu-0.0.1.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8834b3c898f70d7a3ac10b06fde1d6e454e6d091398e9a1ebfccf2b1aecc51c2
|
|
| MD5 |
811af3427b34538671432d134705c63d
|
|
| BLAKE2b-256 |
3e816721145c14204d1f5d4df70d739fe422a895222f864f9e0139a8a63b8321
|
File details
Details for the file zspdu-0.0.1-py3-none-any.whl.
File metadata
- Download URL: zspdu-0.0.1-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74821913d89fbb7fcff810a6d91614a9b66c390ae3440d21f261dc7cdfa53cf2
|
|
| MD5 |
03019c93d9e4f37e13b96ae9ef13b594
|
|
| BLAKE2b-256 |
cb12abb693f07767a701a43bed37035339f64db293c64157be94fe006b2efc5e
|