Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Evict devices from cache when unreachable #26

Closed
mpdifran opened this issue Jan 26, 2014 · 3 comments
Closed

Evict devices from cache when unreachable #26

mpdifran opened this issue Jan 26, 2014 · 3 comments
Labels
Milestone

Comments

@mpdifran
Copy link

I've updated my wemo light switches to the latest firmware recently, and now ouimeaux is crashing when I run wemo status in the command line. I can run wemo list just fine, but it only lists 3 of my 4 switches. Here's the output when I run wemo status:

Switch: TV  1
Switch: Pot Lights  1
Switch: Bedroom     Traceback (most recent call last):
  File "/usr/local/bin/wemo", line 8, in <module>
    load_entry_point('ouimeaux==0.5.2', 'console_scripts', 'wemo')()
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/cli.py", line 162, in wemo
    args.func(args)
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/cli.py", line 104, in status
    scan(args, on_switch, on_motion)
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/cli.py", line 27, in scan
    env.start()
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/environment.py", line 66, in start
    self._process_device(dev, cache=False)
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/environment.py", line 139, in _process_device
    callback(device)
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/cli.py", line 99, in on_switch
    print "Switch:", switch.name, '\t', _state(switch, args.human_readable)
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/cli.py", line 16, in _state
    state = device.get_state(force_update=True)
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/device.py", line 40, in get_state
    return int(self.basicevent.GetBinaryState()['BinaryState'])
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/service.py", line 48, in __call__
    response = requests.post(self.controlURL, body.strip(), headers=self.headers)
  File "/Library/Python/2.7/site-packages/requests-2.2.0-py2.7.egg/requests/api.py", line 88, in post
    return request('post', url, data=data, **kwargs)
  File "/Library/Python/2.7/site-packages/requests-2.2.0-py2.7.egg/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Library/Python/2.7/site-packages/requests-2.2.0-py2.7.egg/requests/sessions.py", line 383, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Python/2.7/site-packages/requests-2.2.0-py2.7.egg/requests/sessions.py", line 486, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Python/2.7/site-packages/requests-2.2.0-py2.7.egg/requests/adapters.py", line 382, in send
    raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.34', port=49154): Max retries exceeded with url: /upnp/control/basicevent1 (Caused by <class 'socket.error'>: [Errno 61] Connection refused)
@iancmcc
Copy link
Owner

iancmcc commented Jan 26, 2014

Try running "wemo clear" first. Possibly the cache has an outdated entry. — Ian

On Sun, Jan 26, 2014 at 12:27 PM, mpdifran [email protected]
wrote:

I've updated my wemo light switches to the latest firmware recently, and now ouimeaux is crashing when I run wemo status in the command line. I can run wemo list just fine, but it only lists 3 of my 4 switches. Here's the output when I run wemo status:

Switch: TV    1
Switch: Pot Lights    1
Switch: Bedroom   Traceback (most recent call last):
  File "/usr/local/bin/wemo", line 8, in <module>
    load_entry_point('ouimeaux==0.5.2', 'console_scripts', 'wemo')()
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/cli.py", line 162, in wemo
    args.func(args)
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/cli.py", line 104, in status
    scan(args, on_switch, on_motion)
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/cli.py", line 27, in scan
    env.start()
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/environment.py", line 66, in start
    self._process_device(dev, cache=False)
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/environment.py", line 139, in _process_device
    callback(device)
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/cli.py", line 99, in on_switch
    print "Switch:", switch.name, '\t', _state(switch, args.human_readable)
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/cli.py", line 16, in _state
    state = device.get_state(force_update=True)
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/device.py", line 40, in get_state
    return int(self.basicevent.GetBinaryState()['BinaryState'])
  File "/Library/Python/2.7/site-packages/ouimeaux-0.5.2-py2.7.egg/ouimeaux/service.py", line 48, in __call__
    response = requests.post(self.controlURL, body.strip(), headers=self.headers)
  File "/Library/Python/2.7/site-packages/requests-2.2.0-py2.7.egg/requests/api.py", line 88, in post
    return request('post', url, data=data, **kwargs)
  File "/Library/Python/2.7/site-packages/requests-2.2.0-py2.7.egg/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Library/Python/2.7/site-packages/requests-2.2.0-py2.7.egg/requests/sessions.py", line 383, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Python/2.7/site-packages/requests-2.2.0-py2.7.egg/requests/sessions.py", line 486, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Python/2.7/site-packages/requests-2.2.0-py2.7.egg/requests/adapters.py", line 382, in send
    raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.34', port=49154): Max retries exceeded with url: /upnp/control/basicevent1 (Caused by <class 'socket.error'>: [Errno 61] Connection refused)

Reply to this email directly or view it on GitHub:
#26

@mpdifran
Copy link
Author

Yup that was it, thanks!

@iancmcc iancmcc added this to the v0.8 milestone Mar 24, 2014
@iancmcc iancmcc added the bug label Mar 24, 2014
@iancmcc iancmcc modified the milestone: v0.8 Mar 24, 2014
@iancmcc iancmcc modified the milestones: v0.8, 0.7.3 Aug 10, 2014
iancmcc added a commit that referenced this issue Aug 11, 2014
@iancmcc
Copy link
Owner

iancmcc commented Aug 11, 2014

I've made the retry mechanism disabled in command-line mode, and I've set it to ignore devices that aren't reachable. Hopefully that leads to a more natural interaction. It'll take some major refactoring to clean this up properly.

@iancmcc iancmcc closed this as completed Aug 11, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants