pywemo

Lightweight Python module to discover and control WeMo devices.

API Documentation

For example usage and installation instructions see README.rst

General structure of the pyWeMo API

Discovery

The pywemo.discovery module contains methods to locate WeMo devices on a network. For example, use the following to discover all devices on the network:

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

Or, if you know the IP address of the device, use this example.

>>> import pywemo
>>> url = pywemo.setup_url_for_address("192.168.1.192")
>>> print(url)
http://192.168.1.192:49153/setup.xml
>>> device = pywemo.device_from_description(url)
>>> print(device)
[<WeMo Insight "AC Insight">]

Devices

The device(s) returned by the discovery methods above will be instances of one of the classes below. These classes, used for communicating with the various WeMo devices, are in submodules under the pywemo.ouimeaux_device module. They can also be accessed as top-level members of the pywemo module.

Example WeMo Model(s) Alias / Class
F7C031 pywemo.Bridge / pywemo.ouimeaux_device.bridge.Bridge
F7C046 pywemo.Humidifier / pywemo.ouimeaux_device.humidifier.Humidifier
F7C045 pywemo.CrockPot / pywemo.ouimeaux_device.crockpot.CrockPot
F7C050 pywemo.CoffeeMaker / pywemo.ouimeaux_device.coffeemaker.CoffeeMaker
F7C028 pywemo.Motion / pywemo.ouimeaux_device.motion.Motion
F7C043 pywemo.Maker / pywemo.ouimeaux_device.maker.Maker
F7C027, F7C063, WSP080 pywemo.Switch / pywemo.ouimeaux_device.switch.Switch
F7C029, F7C029V2 pywemo.Insight / pywemo.ouimeaux_device.insight.Insight
WLS0403, WLS040, F7C030 pywemo.LightSwitchLongPress / pywemo.ouimeaux_device.lightswitch.LightSwitchLongPress
WDS060 pywemo.DimmerV2 / pywemo.ouimeaux_device.dimmer.DimmerV2
F7C059 pywemo.DimmerLongPress / pywemo.ouimeaux_device.dimmer.DimmerLongPress
WSP090 pywemo.OutdoorPlug / pywemo.ouimeaux_device.outdoor_plug.OutdoorPlug

The following are base classes of all of the above device classes.

Additional models and details can be found on this wiki page.

Subscriptions

Most WeMo devices support a push/callback model for reporting state changes. The pywemo.subscribe module provides a way to subscribe to push events.

 1r"""Lightweight Python module to discover and control WeMo devices.
 2
 3.. include:: README.md
 4"""
 5
 6# flake8: noqa F401
 7from .discovery import (
 8    device_from_description,
 9    discover_devices,
10    setup_url_for_address,
11)
12from .exceptions import PyWeMoException
13from .ouimeaux_device import Device as WeMoDevice
14from .ouimeaux_device.api.long_press import LongPressMixin
15from .ouimeaux_device.api.service import Action, Service
16from .ouimeaux_device.bridge import Bridge
17from .ouimeaux_device.bridge import Group as BridgeGroup
18from .ouimeaux_device.bridge import Light as BridgeLight
19from .ouimeaux_device.coffeemaker import CoffeeMaker, CoffeeMakerMode
20from .ouimeaux_device.crockpot import CrockPot, CrockPotMode
21from .ouimeaux_device.dimmer import Dimmer, DimmerLongPress, DimmerV2
22from .ouimeaux_device.heater import Heater
23from .ouimeaux_device.humidifier import (
24    DesiredHumidity,
25    FanMode,
26    Humidifier,
27    WaterLevel,
28)
29from .ouimeaux_device.insight import Insight, StandbyState
30from .ouimeaux_device.lightswitch import LightSwitch, LightSwitchLongPress
31from .ouimeaux_device.maker import Maker
32from .ouimeaux_device.motion import Motion
33from .ouimeaux_device.outdoor_plug import OutdoorPlug
34from .ouimeaux_device.switch import Switch
35from .subscribe import SubscriptionRegistry