tripplite
Python USB interface and command-line tool for TrippLite UPS battery backups.
Background
TrippLite offers UI software for monitoring its batteries. However, most of its batteries don't have network access, and the existing TrippLite software requires a local install.
I wanted to monitor the UPS from a remote headless Linux server, so I wrote this tool.
Installation
apt install gcc libusb-1.0-0-dev libudev-dev
pip install tripplite
Connect a USB cable from the UPS to your headless server, and you should be ready to run. If you don't want to run as root, see Note on Permissions below.
Command Line
$ tripplite
{
"config": {
"frequency": 60, # Hz
"power": 1500, # VA
"voltage": 120 # V
},
"health": 100, # %
"input": {
"frequency": 59.7, # Hz
"voltage": 117.2 # V
},
"output": {
"power": 324, # W
"voltage": 117.2 # V
},
"status": {
"ac present": true,
"below remaining capacity": true,
"charging": false,
"discharging": false,
"fully charged": true,
"fully discharged": false,
"needs replacement": false,
"shutdown imminent": false
},
"time to empty": 1004 # s
}
If you have multiple TrippLite devices connected to the server, you'll need to
specify a product id (findable on lsusb). See tripplite --help for more.
To use in shell scripts, parse the json output with something like
jq. For example,
tripplite | jq '.status."ac present"' will return whether or not the unit
detects AC power.
Python
If you'd like to link this to more complex behavior (e.g. data logging, text alerts), consider using a Python script.
from tripplite import Battery
with Battery() as battery:
print(battery.get())
The state variable will contain an object with the same format as above. Use
state['status']['ac present'] and state['status']['shutdown imminent'] for
alerts, and consider logging voltage, frequency, and power.
Note on Permissions
To read the TrippLite, you need access to the USB port. You have options:
- Run everything as root
- Add your user to the
dialoutgroup to access all serial ports - Create a group restricted to accessing TrippLite USB devices through
udev
For the last option, the rule looks like:
echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="09ae", GROUP="tripplite"' > /etc/udev/rules.d/tripplite.rules
udevadm control --reload-rules
Metadata
Release files for tripplite 0.2.3
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 | Actions |
|---|---|---|---|---|
| tripplite-0.2.3.tar.gz | 4.4 kB | Without provenance | Details for tripplite-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tripplite-0.2.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for tripplite-0.2.3-py2.py3-none-any.whl |
Total release size: 16.2 kB
Release files / tripplite-0.2.3.tar.gz
| Download URL | tripplite-0.2.3.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72bbabe0dcf5afa76f18e5e7884e13bc1417720e3ddf9d80130d32a8e5298878
|
|
BLAKE2b-256 checksum How to use checksums |
1e0c535803da6f5df37a856fb36831b80e8f79778ace445ad9f8b87107e8eabc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.1
|
Release files / tripplite-0.2.3-py2.py3-none-any.whl
| Download URL | tripplite-0.2.3-py2.py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
903fa35e2bc8d9357eebf39678bed9930886bfed74a9bbb5af9f21bf785f0c94
|
|
BLAKE2b-256 checksum How to use checksums |
810d77b71aa871e063c3c5fd7e0bd7fa9798f67b6df6ad7411e8995884d1c339
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.1
|
Security for tripplite 0.2.3
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.