overboard / discoverhue Goto Github PK
View Code? Open in Web Editor NEWDiscovery of hue bridges per the Philips design guide.
License: MIT License
Discovery of hue bridges per the Philips design guide.
License: MIT License
Allow a single IP or list of IPs as input to be validated as bridges.
As we all know, today more than ever before, it is crucial to be able to trust our computing environments. One of the main difficulties that package maintainers of GNU/Linux distributions face, is the difficulty to verify the authenticity and the integrity of the source code. With GPG signatures it is possible for packagers to verify source code releases quickly and easily.
In order to securely package your software I am kindly requesting GPG signatures for the source tarballs. If you are not yet familiar with secure source code signing I recommend using GPGit which automates the process of secure source code signing and also has a quick start guide on GPG for learning how to use it manually.
Thanks in advance.
discoverhue/tests/test_discoverhue.py
Line 488 in 81948ac
Currently, an empty dict for input does not run discovery and simply returns {}. Since a typical use case might would involve feeding it a dict from saved config, then it's possible a new config would yield an empty dict. In that scenario, the desired behavior would be to run discovery.
This would also then mirror behavior of empty lists, etc.
The search for provided IP's should be done with async.
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)
Comparison against provided serial numbers should be case insensitive.
SSDP may utilize wrong interface under Windows. The attempt to avoid issues caused by the SSDP Discovery service was to explicitly select an interface. However, this didn't take into account system configurations with more than one interface associated with the hostname.
We'll either need to iterate through all interfaces returned by socket.gethostbyname_ex() or perhaps revisit the Discovery service interference problem. See:
discoverhue/discoverhue/ssdp.py
Lines 50 to 55 in 63730d2
For the qhue API it is required to know the IP address without all the https:// stuff. It would be nice if you could add a simple function to also get the ip without this extra url.
This is the code I used to strip the URL:
found[bridge].split('/')[2].split(':')[0]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.