Skip to main content

pwrusb

A python wrapper for controlling pwrusb.com power strip outlets.

Installation notes

To avoid copyright issues, several files are not included in this distribution. Makefile will attempt to download and install these files automatically. Or, they can be downloaded from the Mac software distribution from the pwrusb website. These files are:

PwrUSBImp.h
PwrUsbCmd.cpp
libpowerusb.dylib

A version of libusb-1.0 will need to be installed. One straightforward way to get this is via homebrew with:

brew install libusb

The swig package also needs to be installed in your python distribution for pwrusb to work. One straightforward way to get this is via homebrew with:

brew install swig

Typical Installation

From PyPI:

pip install pwrusb

Usage

Example usage:

import pwrusb
print("State of all outlets: {}".format(pwrusb.get_all_outlet_states()))
# turn ON all outlets
pwrusb.set_all_outlet_states(True)
print("State of all outlets: {}".format(pwrusb.get_all_outlet_states()))
# turn ON outlets 1 and 3
pwrusb.set_all_outlet_states([True, False, True])
print("State of all outlets: {}".format(pwrusb.get_all_outlet_states()))
# turn OFF all outlets
pwrusb.set_all_outlet_states(False)
print("State of all outlets: {}".format(pwrusb.get_all_outlet_states()))
# turn ON outlet #3, not changing outlets 1 or 2
pwrusb.set_outlet_state(3, True)
# read state of only outlet #3
pwrusb.get_outlet_state(3)

Additional Usage Notes

Lighted power switch on pwrusb.com strips controls power to outlets, but does not power on/off the USB controller within the strip. When the physical switch is off, strip should report a low (but not zero) current draw and will report what state the outlets will be when the physical switch is flipped back on, i.e. can report True even when no power is coming out of an outlet.

History

  • Originally written by hroe in 2014-January.

  • Repackaged for upload to github and pypi in 2014-October.

  • Lots of small updates to project layout etc, including update to Python 3.5 compatibility in 2016-March.

Metadata

Release files for pwrusb 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pwrusb 1.0.3
File Size Uploaded
pwrusb-1.0.3.tar.gz 43.8 kB Details

Release files / pwrusb-1.0.3.tar.gz

Download URL pwrusb-1.0.3.tar.gz
Size 43.8 kB
Tags Source
SHA-256 checksum
How to use checksums
715d434440971f60b64c479d3106055971162fae7e44ef6f83c1a5fe07fa28e5
BLAKE2b-256 checksum
How to use checksums
705888eaf8514ac480d70f400ea61fbcb8236c455257e1895f94346ffe2cfd8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page