platypush.plugins.switch.wemo

class platypush.plugins.switch.wemo.SwitchWemoPlugin(devices=None, netmask: Optional[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: Optional[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)

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]

Status function - if not overridden it calls switch_status(). You may want to override it if your plugin does not handle only switches.

property switches

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

[
    {
        "ip": "192.168.1.123",
        "name": "Switch 1",
        "on": true
    },
    {
        "ip": "192.168.1.124",
        "name": "Switch 2",
        "on": false
    }
]
toggle(device: str, *args, **kwargs)[source]

Toggle a device on/off state

Parameters

device – Device name or address