Skip to content

Latest commit

 

History

History
64 lines (45 loc) · 2.23 KB

README.rst

File metadata and controls

64 lines (45 loc) · 2.23 KB

pyWeMo Status of latest Travis CI build Latest PyPI version Number of PyPI downloads

Lightweight Python 2 and Python 3 module to discover and control WeMo devices.

This is a stripped down version of the Python API for WeMo devices, ouimeaux, with simpler dependencies.

Dependencies

pyWeMo depends on Python packages: requests, ifaddr and six

How to use

>> import pywemo

>> devices = pywemo.discover_devices()
>> print(devices)
[<WeMo Insight "AC Insight">]

>> devices[0].toggle()

If discovery doesn't work on your network

On some networks discovery doesn't work reliably, in that case if you can find the ip address of your Wemo device you can use the following code.

>> import pywemo

>> address = "192.168.100.193"
>> port = pywemo.ouimeaux_device.probe_wemo(address)
>> url = 'http://%s:%i/setup.xml' % (address, port)
>> device = pywemo.discovery.device_from_description(url, None)
>> print(device)
<WeMo Insight "AC Insight">

Please note that you must use IP addresses here, rather than hostnames. First, because subscription update logic won't work properly; second, because recent versions of the WeMo firmware may not accept connections from hostnames, and will return a 500 error.

Developing

Setup and builds are fully automated. You can run build pipeline locally by running.

# Setup, build, lint and test the code:

./scripts/build.sh

License

The code in pywemo/ouimeaux_device is written and copyright by Ian McCracken and released under the BSD license. The rest is released under the MIT license.