platypush.plugins.switch.tplink

class platypush.plugins.switch.tplink.SwitchTplinkPlugin(plugs: Optional[Union[Dict[str, str], List[str]]] = None, bulbs: Optional[Union[Dict[str, str], List[str]]] = None, strips: Optional[Union[Dict[str, str], List[str]]] = None, **kwargs)[source]

Plugin to interact with TP-Link smart switches/plugs like the HS100 (https://www.tp-link.com/us/products/details/cat-5516_HS100.html).

Requires:

  • pyHS100 (pip install pyHS100)

__init__(plugs: Optional[Union[Dict[str, str], List[str]]] = None, bulbs: Optional[Union[Dict[str, str], List[str]]] = None, strips: Optional[Union[Dict[str, str], List[str]]] = None, **kwargs)[source]
Parameters
  • plugs – Optional list of IP addresses or name->address mapping if you have a static list of TpLink plugs and you want to save on the scan time.

  • bulbs – Optional list of IP addresses or name->address mapping if you have a static list of TpLink bulbs and you want to save on the scan time.

  • strips – Optional list of IP addresses or name->address mapping if you have a static list of TpLink strips and you want to save on the scan time.

off(device, **kwargs)[source]

Turn off a device

Parameters

device (str) – Device IP, hostname or alias

on(device, **kwargs)[source]

Turn on a device

Parameters

device (str) – Device IP, hostname or alias

property switches
Returns

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

toggle(device, **kwargs)[source]

Toggle the state of a device (on/off)

Parameters

device (str) – Device IP, hostname or alias