platypush.plugins.switch.wemo

class platypush.plugins.switch.wemo.SwitchWemoPlugin(devices=None, netmask: str = None, port: int = 49153, **kwargs)[source]

Plugin to control a Belkin WeMo smart switches (https://www.belkin.com/us/Products/home-automation/c/wemo-home-automation/)

Requires:

  • requests (pip install requests)
__init__(devices=None, netmask: str = None, port: int = 49153, **kwargs)[source]
Parameters:
  • devices (list or dict) – List of IP addresses or name->address map containing the WeMo Switch devices to control. This plugin previously used ouimeaux for auto-discovery but it’s been dropped because 1. too slow 2. too heavy 3. auto-discovery failed too often.
  • netmask – Alternatively to a list of static IP->name pairs, you can specify the network mask where the devices should be scanned (e.g. ‘192.168.1.0/24’)
  • port – Port where the WeMo devices are expected to expose the RPC/XML over HTTP service (default: 49153)
devices

Get the list of available devices :returns: The list of devices.

Example output:

output = [
        {
            "ip": "192.168.1.123",
            "name": "Switch 1",
            "on": true,
        },

        {
            # ...
        }
    ]
get_name(device: str)[source]

Get the friendly name of a device

Parameters:device – Device name or address
get_state(device: str)[source]

Get the on state of a device (True/False)

Parameters:device – Device name or address
off(device: str, **kwargs)[source]

Turn a switch off

Parameters:device – Device name or address
on(device: str, **kwargs)[source]

Turn a switch on

Parameters:device – Device name or address
status(device: str = None, *args, **kwargs)[source]

Get the status of a specified device or of all the configured devices (default)

toggle(device: str, *args, **kwargs)[source]

Toggle a device on/off state

Parameters:device – Device name or address