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]

Get the status of all the devices, or filter by device name or ID (alias for switch_status()).

Parameters

device – Filter by device name or ID.

Returns

[
  {
    "id": "Device unique ID",
    "name": "Device name",
    "on": "True if the device is on, False otherwise"
  }
]

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