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:
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.get_state() 0 >> devices.toggle() >> devices.get_state() 1 >>
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.