Skip to main content

Lightweight Python module to discover and control WeMo devices

Project description

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
>>> url = pywemo.setup_url_for_address("192.168.1.192", None)
>>> print(url)
http://192.168.1.192:49153/setup.xml
>>> device = pywemo.discovery.device_from_description(url, None)
>>> print(device)
<WeMo Maker "Hi Fi Systemline Sensor">

Please note that discovery.device_from_description call requires a url with an IP address, rather than a hostnames. This is needed for the subscription update logic to work properly. In addition recent versions of the WeMo firmware may not accept connections from hostnames, and will return a 500 error.

The setup_url_for_address function will lookup a hostname and provide a suitable url with an IP addesss.

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.

Project details


Release history Release notifications | RSS feed

This version

0.5.2

Download files

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

Source Distribution

pywemo-0.5.2.tar.gz (43.0 kB view details)

Uploaded Source

Built Distribution

pywemo-0.5.2-py3-none-any.whl (50.7 kB view details)

Uploaded Python 3

File details

Details for the file pywemo-0.5.2.tar.gz.

File metadata

  • Download URL: pywemo-0.5.2.tar.gz
  • Upload date:
  • Size: 43.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.7.9 Linux/5.4.0-1031-azure

File hashes

Hashes for pywemo-0.5.2.tar.gz
Algorithm Hash digest
SHA256 b622f3b950cbc0450895d4422574958cdbf65f354d46da6a3d5b0f997becbbfc
MD5 72cd6c2761f23f3544fa0596d90e9c2a
BLAKE2b-256 c6d9a9373e33f5d967e329eec4644fb7ff4bc6dfb33f97f89e2e30b4847de402

See more details on using hashes here.

Provenance

File details

Details for the file pywemo-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: pywemo-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 50.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.7.9 Linux/5.4.0-1031-azure

File hashes

Hashes for pywemo-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7b46c6335824a41dc4e867c5dc8e51e29470ba6b437aa39208483bcc0eb0e32e
MD5 9bd6c189ade5c8c0d12b223f19081ef8
BLAKE2b-256 3bcaf9e2029bb09aeff571fad4de406d5963a09060baa4ee758e771e5167815e

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page