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.
Metadata
Release files for zspdu 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| zspdu-0.0.1.tar.gz | 6.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| zspdu-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.7 kB
Release files / zspdu-0.0.1.tar.gz
| Download URL | zspdu-0.0.1.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8834b3c898f70d7a3ac10b06fde1d6e454e6d091398e9a1ebfccf2b1aecc51c2
|
|
BLAKE2b-256 checksum How to use checksums |
3e816721145c14204d1f5d4df70d739fe422a895222f864f9e0139a8a63b8321
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / zspdu-0.0.1-py3-none-any.whl
| Download URL | zspdu-0.0.1-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
74821913d89fbb7fcff810a6d91614a9b66c390ae3440d21f261dc7cdfa53cf2
|
|
BLAKE2b-256 checksum How to use checksums |
cb12abb693f07767a701a43bed37035339f64db293c64157be94fe006b2efc5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for zspdu 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.