diyhue / diyHue

Main diyHue software repo
https://diyhue.org/
Other
1.58k stars 280 forks source link

KeyError: 'huesigne' after pairing Hue Signe light via Hue Hub #747

Closed syphernl closed 2 years ago

syphernl commented 2 years ago

Describe the bug After configuring the lights in the Hue app, the hue app started to load indefinitly. In the console an error is shown (see logs)

Steps to Reproduce

Expected behavior

Logs

[2022-01-07 12:29:50,663] ERROR in app: Exception on /clip/v2/resource [GET]
Traceback (most recent call last):
  File "/home/diyhue/.local/lib/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/diyhue/.local/lib/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/diyhue/.local/lib/python3.9/site-packages/flask_restful/__init__.py", line 468, in wrapper
    resp = resource(*args, **kwargs)
  File "/home/diyhue/.local/lib/python3.9/site-packages/flask/views.py", line 89, in view
    return self.dispatch_request(*args, **kwargs)
  File "/home/diyhue/.local/lib/python3.9/site-packages/flask_restful/__init__.py", line 583, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/opt/hue-emulator/BridgeEmulator/flaskUI/v2restapi.py", line 224, in get
    data.append(light.getV2Api())
  File "/opt/hue-emulator/BridgeEmulator/HueObjects/__init__.py", line 381, in getV2Api
    "archetype": archetype[self.config["archetype"]]}
KeyError: 'huesigne'

Docker Info (please complete the following information):

Checklist

Additional context Oddly, the huesigne reference is not found in the configuration at all. The Hue Signe bulb is configured by diyHue as such in config/lights.yaml:

'22':
  id_v2: xxxxxxxxxxxxxxxxxxxxxxxxxxx
  name: Signe
  modelid: LCT015
  uniqueid: xxxxxxxxxxxxxxxxxxxx
  state:
    'on': false
    bri: 182
    hue: 42096
    sat: 70
    xy:
    - 0.3189
    - 0.3279
    ct: 162
    alert: lselect
    mode: homeautomation
    effect: none
    colormode: xy
    reachable: true
  config:
    archetype: sultanbulb
    function: mixed
    direction: omnidirectional
    startup:
      mode: safety
      configured: true
  protocol: hue
  protocol_cfg:
    ip: xxxxxxxxxxxxx
    hueUser: xxxxxxxxxxxxxxxxxxxxx
    modelid: 4080248P9
    id: '18'
    uniqueid: xxxxxxxxxxxxxxxxxxxxx

After restarting the Hue app started working again and shows all bulbs. Once you change its icon to signe again it immediately starts failing which gets resolved after a reboot (but then the icon reverted again):

xxxxxxxxxxxx- - [07/Jan/2022 12:39:32] "GET /api/config HTTP/1.1" 200 -
{'archetype': 'huesigne'}
[{'success': {'/lights/22/config/archetype': 'huesigne'}}]
xxxxxxxxxxxx - - [07/Jan/2022 12:39:33] "PUT /api/xxxxxxxxxxxxxxxxxxxxxxxx/lights/22/config HTTP/1.1" 200 -

IIRC, when I used the HA integration rather than the Hue Bridge pairing I was able to change the icons just fine.

mariusmotea commented 2 years ago

Error is caused by lack of Hue Signe in this array:

https://github.com/diyhue/diyHue/blob/beta/BridgeEmulator/lights/light_types.py#L61

Here the arch names are converted from V1 api to V2 api. I think it must be huesigne: hue_signe but i need to check before i add it there.

GitHub
diyHue/light_types.py at beta · diyhue/diyHue
Main diyHue software repo. Contribute to diyhue/diyHue development by creating an account on GitHub.
stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not been verified. If this is still an issue, please provide the more information so that we are able to understand the issue. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 2 years ago

This issue has been automatically closed as it has not had any recent activity. Thank you for your contributions.