Has anyone any useful experience with running the ouimeaux application (which provides a Python interface to WeMo devices) under Python 3.x?
If I use pip to install it to run with Python 2, everything seems to work as documented, both for the standalone CLI 'wemo' application and when you import the environment library into a python (2) script. If you install it with pip3 to run with Python 3, however, the standalone CLI application will run (with minor, and reasonably obvious, tweaks to a couple of its subsidiary scripts), and the environment library will load, but even simple attempts to access the latter's functionality provoke various errors suggesting that it has not been properly converted to Python 3. I would like to control my WeMo devices from Python scripts, and I really don't want to invest in a deprecated and dying dialect. My needs are fairly simple (just switches - no motion sensing), so I could probably reverse engineer the working CLI application code to create a library to do what I need, but is there an easy fix to ouimeaux for Python 3, or another, Python 3 compatible, approach to WeMo control that I have missed?
-
- Posts: 634
- Joined: Sat Feb 24, 2018 4:09 am
- Location: Buffalo, NY, USA
-
- Posts: 634
- Joined: Sat Feb 24, 2018 4:09 am
- Location: Buffalo, NY, USA
Re: Using ouimeaux with Python 3 on Buster
More searching found pywemo (https://github.com/pavoni/pywemo), which provides the facilities that I need under Python 3 in a usable form, though you have to do some spelunking in the code to work out how to use it.
Re: Using ouimeaux with Python 3 on Buster
I used ouimeaux for the past year or so until it stopped working recently for some reason. Even when it was working I still had to send multiple commands to get it to turn switches on and off. Ultimately it was a blessing because I found a bash script that works very reliably from a Windows command line but you have to activate the Linux subsystem in Windows 10 and install Ubuntu which is no biggy. Instructions here: https://www.howtogeek.com/249966/how-to ... indows-10/ Only caveat is you have to direct commands to a Wemo switch's specific IP address so IP reservation is a must.
Usage is:
wemo_control IP_ADDRESS ON/OFF/GETSTATE/GETSIGNALSTRENGTH/GETFRIENDLYNAME
My Windows .bat file looks like this:
wemo_control.sh is in the attached zip file. Hope this helps!
Usage is:
wemo_control IP_ADDRESS ON/OFF/GETSTATE/GETSIGNALSTRENGTH/GETFRIENDLYNAME
My Windows .bat file looks like this:
Code: Select all
ubuntu run /mnt/c/Users/Dennis/Documents/wemo_control.sh 192.168.86.142 OFF
- Attachments
-
- wemo_control.zip
- (863 Bytes) Downloaded 62 times
Last edited by replayreb on Tue Oct 01, 2019 8:22 pm, edited 1 time in total.
Re: Using ouimeaux with Python 3 on Buster
I copied and pasted the above from a reply I posted on another forum so of course you don't need to install ubuntu on the Raspberry Pi. Just use wemo_control.sh and the command would be:
Code: Select all
wemo_control 192.168.86.142 OFF