Belkin brand Wemo plug control
Project description
pyblinky
Control Belkin brand Wemo smart plugs synchronously or asynchronously.
Options
Parameter | Default | Description |
---|---|---|
ip | Required | Network location of plug[^1] |
timeout | 3 | Seconds to wait for response |
name_cache_age | 0 | Seconds to store plug name before re-querying it |
Actions
Action | Parameters | Description |
---|---|---|
on | None | Turn plug on |
off | None | Turn plug off |
toggle | None | Change plug status |
burst | seconds | Turn on plug, wait num seconds, then turn off |
status | None | Get status of plug as (bool) |
identify | None | Get name of plug (str) |
rename | name | Rename plug |
A more thorough list of available actions on the plug is documented here and some may be implemented here in the future.
Examples
Synchronous
from pyblinky import Wemo
plug = Wemo('192.168.1.87')
print(plug.status())
print(plug.identify())
plug.on()
Asynchronous
import asyncio
from pyblinky import AsyncWemo
plugs = [
AsyncWemo('192.168.1.87'),
AsyncWemo('192.168.1.88'),
AsyncWemo('192.168.1.89')
]
async def main():
result = await asyncio.gather(
*(
[
x.status()
for x in plugs
] +
[
y.identify()
for y in plugs
]
)
)
print(result)
if __name__ == '__main__':
asyncio.run(main())
[^1]: This project does not implement UPnP interface for device discovery, instead talking to plugs directly by IP address. It is highly recommended to set static IPs for plugs. Discovery may be added at a later date if a suitable library can be found.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyblinky-4.0.0.tar.gz
(5.5 kB
view details)
Built Distribution
File details
Details for the file pyblinky-4.0.0.tar.gz
.
File metadata
- Download URL: pyblinky-4.0.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38ee718223ec3685fee03994e7a337adb59d426487de86b90bc8560eabfce604 |
|
MD5 | dc6dc06b621bc076113b9ccb92eb9d4a |
|
BLAKE2b-256 | a8e09c1cbcc798452d748dacddb3784adbad83df552cea900434b4e562f41417 |
File details
Details for the file pyblinky-4.0.0-py3-none-any.whl
.
File metadata
- Download URL: pyblinky-4.0.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65c4168a012720e74ab97ab9f28362762e10beb4b3658208da72472c48883681 |
|
MD5 | 87dd1249619ad1ebf4e1a1bba49bf1b5 |
|
BLAKE2b-256 | 12717d23d4c69258b3cdf94bd1779da700a1021ddc3ae489b65a39190b2e4246 |