iancmcc/ouimeaux

wemo command slow and cache file not created

martinbutt opened this issue · 4 comments

Perhaps the two are related. When I run the wemo command, it hangs for a few seconds, even if I pass no parameters. Also, the cache file is not created. I can't find out which version I'm running because -v doesn't seem to work, I just get:

$ wemo -v
usage: wemo [-h] [-b BIND] [-d] [-e] [-v] [-t TIMEOUT]
            {status,switch,maker,light,list,server} ...
wemo: error: too few arguments

But this is a recent install using

$ easy_install ouimeaux

as per the documentation.

I'm running everything as root.

$ wemo status
('Switch:', 'Fan', '\t', 0)
('Switch:', 'Speaker', '\t', 1)
('Switch:', 'Monitor', '\t', 1)
$ wemo list
('Switch:', 'Fan')
('Switch:', 'Speaker')
('Switch:', 'Monitor')
$ cat ~/.wemo/config.yml 
cache: true
$ ls ~/.wemo/cache
ls: cannot access /root/.wemo/cache: No such file or directory

Is there something I need to do to trigger the cache?

The cache was removed in a previous version because it was causing problems and wasn't working well. It works very well without the cache.

The '-v' option doesn't show the version number, if you read the documentation you'll understand exactly what each option does.

I have found that to make the command more consistent and work every time, you should use the timeout option, '-t' and set it to 10 seconds.

The cache information is still in the docs, so that threw me off. I see that "wemo -h" gives better usage information. I've played around with the flags, including "-t", but to no end. This is a typical connection for me:

$ time wemo switch Monitor on

real    0m10.041s
user    0m6.340s
sys     0m0.680s

Is that normal?

Here is the full debug log:

$ time wemo -d switch Monitor on
DEBUG:ouimeaux.discovery:Binding datagram server to 192.168.2.24:54321
INFO:ouimeaux.environment:Discovering devices
DEBUG:ouimeaux.discovery:Broadcasting M-SEARCH to 239.255.255.250:1900
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:1900
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:37176
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:49201
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:49201
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:49201
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:49201
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:49201
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:49201
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:49201
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:49201
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:49201
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:49201
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:49201
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:49201
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:49201
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:49201
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:49201
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:49201
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.43:36810
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.27:48412
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:37176
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:37176
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.21:3115
DEBUG:ouimeaux.discovery:Found WeMo at http://192.168.2.21:49154/setup.xml
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.21
DEBUG:urllib3.connectionpool:"GET /setup.xml HTTP/1.1" 200 4416
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.21
DEBUG:urllib3.connectionpool:"GET /setupservice.xml HTTP/1.1" 200 3278
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.21
DEBUG:urllib3.connectionpool:"GET /timesyncservice.xml HTTP/1.1" 200 1718
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.21
DEBUG:urllib3.connectionpool:"GET /eventservice.xml HTTP/1.1" 200 19317
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.21
DEBUG:urllib3.connectionpool:"GET /firmwareupdate.xml HTTP/1.1" 200 1826
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.21
DEBUG:urllib3.connectionpool:"GET /rulesservice.xml HTTP/1.1" 200 9668
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.21
DEBUG:urllib3.connectionpool:"GET /metainfoservice.xml HTTP/1.1" 200 1132
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.21
DEBUG:urllib3.connectionpool:"GET /remoteaccess.xml HTTP/1.1" 200 3974
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.21
DEBUG:urllib3.connectionpool:"GET /deviceinfoservice.xml HTTP/1.1" 200 9922
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.21
DEBUG:urllib3.connectionpool:"GET /smartsetup.xml HTTP/1.1" 200 2536
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.21
DEBUG:urllib3.connectionpool:"GET /manufacture.xml HTTP/1.1" 200 642
INFO:ouimeaux.environment:Found device <WeMo Switch "Speaker"> at ('192.168.2.21', 3115)
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.21
DEBUG:urllib3.connectionpool:"POST /upnp/control/basicevent1 HTTP/1.1" 200 285
DEBUG:ouimeaux.discovery:Broadcasting M-SEARCH to 239.255.255.250:1900
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:37176
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:37176
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.23:3090
DEBUG:ouimeaux.discovery:Found WeMo at http://192.168.2.23:49153/setup.xml
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:37176
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.23
DEBUG:urllib3.connectionpool:"GET /setup.xml HTTP/1.1" 200 4412
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.23
DEBUG:urllib3.connectionpool:"GET /setupservice.xml HTTP/1.1" 200 3278
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.23
DEBUG:urllib3.connectionpool:"GET /timesyncservice.xml HTTP/1.1" 200 1718
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.23
DEBUG:urllib3.connectionpool:"GET /eventservice.xml HTTP/1.1" 200 19317
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.23
DEBUG:urllib3.connectionpool:"GET /firmwareupdate.xml HTTP/1.1" 200 1826
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.23
DEBUG:urllib3.connectionpool:"GET /rulesservice.xml HTTP/1.1" 200 9668
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.23
DEBUG:urllib3.connectionpool:"GET /metainfoservice.xml HTTP/1.1" 200 1132
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.23
DEBUG:urllib3.connectionpool:"GET /remoteaccess.xml HTTP/1.1" 200 3974
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.23
DEBUG:urllib3.connectionpool:"GET /deviceinfoservice.xml HTTP/1.1" 200 9922
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.23
DEBUG:urllib3.connectionpool:"GET /smartsetup.xml HTTP/1.1" 200 2536
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.23
DEBUG:urllib3.connectionpool:"GET /manufacture.xml HTTP/1.1" 200 642
INFO:ouimeaux.environment:Found device <WeMo Switch "Fan"> at ('192.168.2.23', 3090)
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.23
DEBUG:urllib3.connectionpool:"POST /upnp/control/basicevent1 HTTP/1.1" 200 285
DEBUG:ouimeaux.discovery:Broadcasting M-SEARCH to 239.255.255.250:1900
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:37176
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:37176
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.22:3117
DEBUG:ouimeaux.discovery:Found WeMo at http://192.168.2.22:49154/setup.xml
DEBUG:ouimeaux.discovery:Received a response from 192.168.2.1:1900
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.22
DEBUG:urllib3.connectionpool:"GET /setup.xml HTTP/1.1" 200 4416
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.22
DEBUG:urllib3.connectionpool:"GET /setupservice.xml HTTP/1.1" 200 3278
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.22
DEBUG:urllib3.connectionpool:"GET /timesyncservice.xml HTTP/1.1" 200 1718
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.22
DEBUG:urllib3.connectionpool:"GET /eventservice.xml HTTP/1.1" 200 19317
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.22
DEBUG:urllib3.connectionpool:"GET /firmwareupdate.xml HTTP/1.1" 200 1826
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.22
DEBUG:urllib3.connectionpool:"GET /rulesservice.xml HTTP/1.1" 200 9668
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.22
DEBUG:urllib3.connectionpool:"GET /metainfoservice.xml HTTP/1.1" 200 1132
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.22
DEBUG:urllib3.connectionpool:"GET /remoteaccess.xml HTTP/1.1" 200 3974
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.22
DEBUG:urllib3.connectionpool:"GET /deviceinfoservice.xml HTTP/1.1" 200 9922
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.22
DEBUG:urllib3.connectionpool:"GET /smartsetup.xml HTTP/1.1" 200 2536
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.22
DEBUG:urllib3.connectionpool:"GET /manufacture.xml HTTP/1.1" 200 642
INFO:ouimeaux.environment:Found device <WeMo Switch "Monitor"> at ('192.168.2.22', 3117)
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.22
DEBUG:urllib3.connectionpool:"POST /upnp/control/basicevent1 HTTP/1.1" 200 285
INFO:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.22
DEBUG:urllib3.connectionpool:"POST /upnp/control/basicevent1 HTTP/1.1" 200 376

real    0m12.751s
user    0m6.610s
sys     0m0.770s

Yeah I'm going to have to disagree about the cache causing problems, because I'm having issues with the new version that I was not having when I had a cache :-(

So maybe the cache was causing some problems for some people, but removing it has surely caused some problems for some other people.

I'm going to have to go back to an old version that includes it, because my "on at 7 PM, off at 7 AM" air purifiers are missing their commands a LOT more than they were when I had a cache (and cleared it hourly and did a rediscovery) ... I don't know, is it possible commands can be sent into the nether and make it when it already knows where it is going, at a time when discovery would fail? Flaky wireless signal, UDP based discovery and TCP based control or something? I don't know the specifics of how or why, I'm just throwing out a guess, but my stuff is not turning on and off consistently anymore since upgrading to a version without caching.

I have to agree with hyacin75. I moved to 0.8.0 and started having nothing but problems with switches that couldn't be discovered. Yes, with cache I would have these problems occasionally, but without cache it got exponentially worse.

As fas as I know there's an option to disable the cache when instantiating the Environment, so I'm not clear why cache had to be removed entirely.

Downgraded back to 0.7.x.