Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

A python wrapper for controlling power strip outlets.

Project description


A python wrapper for controlling 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:


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


Example usage:

import pwrusb
print("State of all outlets: {}".format(pwrusb.get_all_outlet_states()))
# turn ON all outlets
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
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

Additional Usage Notes

Lighted power switch on 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.


  • 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.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pwrusb, version 1.0.3
Filename, size File type Python version Upload date Hashes
Filename, size pwrusb-1.0.3.tar.gz (43.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page