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.
The following are base classes of all of the above device classes.
- pywemo.ouimeaux_device.Device: Provides common methods for getting/setting device state.
- pywemo.ouimeaux_device.api.xsd_types.DeviceDescription: Provides information about the device name, mac address, firmware version, serial number, etc.
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