exking / udi-hue-poly

Hue interface Poly for Polyglot v2
MIT License
2 stars 0 forks source link

Attempting to query for Group "0" results in error #1

Closed shbatm closed 6 years ago

shbatm commented 6 years ago

Attempting to call /api/username/groups/0 results in an error during initialization of the Node server.

2018-02-12 12:50:57,052 DEBUG    GET /api/376169333a8f86f59a543592a68d7017eb37da84/groups/ None
2018-02-12 12:50:57,089 DEBUG    GET /api/376169333a8f86f59a543592a68d7017eb37da84/groups/0 None
2018-02-12 12:50:57,101 ERROR    MQTT Received Payload Error: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/home/skynet/.local/lib/python3.5/site-packages/polyinterface/polyinterface.py", line 222, in _message
    self.inConfig(parsed_msg[key])
  File "/home/skynet/.local/lib/python3.5/site-packages/polyinterface/polyinterface.py", line 432, in inConfig
    watcher(config)
  File "/home/skynet/.local/lib/python3.5/site-packages/polyinterface/polyinterface.py", line 588, in _gotConfig
    self.start()
  File "./hue.py", line 37, in start
    self.discover()
  File "./hue.py", line 131, in discover
    self.groups = self._get_groups()
  File "./hue.py", line 192, in _get_groups
    groups = self.hub.get_group()
  File "/home/skynet/.polyglot/nodeservers/Hue/phue.py", line 1069, in get_group
    groups['0'] = self.request('GET', '/api/' + self.username + '/groups/0')
  File "/home/skynet/.polyglot/nodeservers/Hue/phue.py", line 667, in request
    return json.loads(response.decode('utf-8'))
  File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

This started after including Pull Request studioimaginaire/phue#100 in commit b1ad8ab27c26e29ac846728291e97ae175001b55 and is a result of this line:

groups['0'] = self.request('GET', '/api/' + self.username + '/groups/0')

According to the Hue API: Group "0" is "A special group containing all lights in the system, and is not returned by the ‘get all groups’ command. This group is not visible, and cannot be created, modified or deleted using the API."

When calling /api/username/groups/0 in a web browser, nothing is returned.

shbatm commented 6 years ago

Disregard -- Traced this back to an issue with a Hue bridge emulator, not a issue with an actual bridge.