Git Product home page Git Product logo

discoverhue's People

Contributors

overboard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

clach04

discoverhue's Issues

GPG signatures for source validation

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.

Change behavior for empty dict

@unittest.expectedFailure

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.

find_bridges throws multiple exceptions

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)

SSDP may utilize wrong interface

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:

# see https://stackoverflow.com/questions/32682969
if sys.platform == "win32":
host = socket.gethostbyname(socket.gethostname())
sock.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_IF, socket.inet_aton(host))
sock.setsockopt(socket.SOL_IP, socket.IP_ADD_MEMBERSHIP,
socket.inet_aton(group[0]) + socket.inet_aton(host))

Only return IP address

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]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.