switch.wemo
#
- class platypush.plugins.switch.wemo.SwitchWemoPlugin(*_, **__)[source]#
Bases:
RunnablePlugin
,SwitchEntityManager
Plugin to control a Belkin WeMo smart switches (https://www.belkin.com/us/Products/home-automation/c/wemo-home-automation/)
- __init__(devices: Collection[str] | Mapping[str, str] | None = None, netmask: str | None = None, port: int = 49153, **kwargs)[source]#
This plugin previously used
ouimeaux
for auto-discovery, but it’s been dropped because:Too slow
Too heavy
Auto-discovery failed too often
However, this also means that you now have to specify either:
devices
: The devices you want to control, as a static list/mapnetmask
: The IP netmask that should be scanned for WeMo devices
- Parameters:
devices (list or dict) – List of IP addresses or name->address map containing the WeMo Switch devices to control.
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
- status(device: str | Collection[str] | None = None, publish_entities: bool = True, **__) List[dict] [source]#
All derived classes should implement this method.
At the very least, this method should refresh the current state of the integration’s entities and call
publish_entities()
.It should also return the current state of the entities as a list of serialized entities, if possible.
- toggle(device: str, *_, **__)[source]#
Toggle a device on/off state
- Parameters:
device – Device name or address
- transform_entities(entities: Collection[dict]) List[Entity] [source]#
This method takes a list of entities in any (plugin-specific) format and converts them into a standardized collection of Entity objects. Since this method is called by
publish_entities()
before entity updates are published, you may usually want to extend it to pre-process the entities managed by your extension into the standard format before they are stored and published to all the consumers.