First thing's first, I set out to see if there were any packages available to control a Wemo switch from inside the LAN. There are indeed as on the local network the system uses UPNP/Rest for control.
There are tons of libraries for this across different languages. I ended up using the pywemo library:
https://github.com/pavoni/pywemo
It's easy to install with pip:
pip3 install pywemo
And basic control is just a few lines:
>>> import pywemo
>>> devices = pywemo.discover_devices()
>>> print(devices)
[<WeMo LightSwitch "Crabapple">]
>>> devices[0].get_state()
0
>>> devices[0].toggle()
>>> devices[0].get_state()
1
>>>
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.