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.

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

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

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