Overboard / discoverhue

Discovery of hue bridges per the Philips design guide.
MIT License
10 stars 1 forks source link

find_bridges throws multiple exceptions #9

Open Morg42 opened 2 years ago

Morg42 commented 2 years ago

Hi,

just trying to run discoverhue.find_bridges, which fails:

>>> import discoverhue
>>> found = discoverhue.find_bridges()
Problem at portal: HTTP Error 404: Not Found
Traceback (most recent call last):
  File "/home/sh/.local/lib/python3.7/site-packages/discoverhue/discoverhue.py", line 257, in find_bridges
    found_bridges.update(via_upnp())
  File "/home/sh/.local/lib/python3.7/site-packages/discoverhue/discoverhue.py", line 169, in via_upnp
    raise DiscoveryError('SSDP returned nothing')
discoverhue.discoverhue.DiscoveryError: SSDP returned nothing

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sh/.local/lib/python3.7/site-packages/discoverhue/discoverhue.py", line 260, in find_bridges
    found_bridges.update(via_nupnp())
  File "/home/sh/.local/lib/python3.7/site-packages/discoverhue/discoverhue.py", line 173, in via_nupnp
    bridges_from_portal = parse_portal_json()
  File "/home/sh/.local/lib/python3.7/site-packages/discoverhue/discoverhue.py", line 129, in parse_portal_json
    json_str = from_url('https://www.meethue.com/api/nupnp')
  File "/home/sh/.local/lib/python3.7/site-packages/discoverhue/discoverhue.py", line 55, in from_url
    with urllib.request.urlopen(req) as response:
  File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.7/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

The hue bridge is running and working (with the iOS hue app), I can open the web interface and access the API info URL at https://hue/api/0/config (hue being the local DNS name, IP works as well).

Trying discovery with dns-sd works as per developer docs.

Anything I can/need to to from my side?

The bridge updated its firmware (forced by iOS app) on startup, not sure if this is relevant. Current API info is

{"name":"Philips hue","datastoreversion":"112","swversion":"1947108030","apiversion":"1.47.0","mac":"xxx","bridgeid":"xxx","factorynew":false,"replacesbridgeid":null,"modelid":"BSB002","starterkitid":""}

Oh, discoverhue is v1.0.2 (current install via pip3)

R0CKB0TT0M commented 1 year ago

had the same problem but I think I solved it. the timeout in ssdp_discover is to short it can sometimes work but if there is a lot of traffic on the network it will always fail