diyhue / diyHue

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

Error 500 when configuring Hue Dimmer Switch from Hue app #1055

Open OACDesigns opened 3 days ago

OACDesigns commented 3 days ago

Issue does not already exist?

I have searched and found no existing issue

Select Environment

Docker

Home Assistant related?

No

Description

I am unable to set up my Hue dimmer switches from the Hue app. Doing so results in an error 500 in my docker logs due to KeyError: 'where'.
I've tried doing a fresh install, and only setting up the minimum config options to add the lights and dimmers from zigbee2mqtt , and still I get this error.
This is the output in the docker logs:

2024-11-24 18:20:02,334 - flaskUI.v2restapi - 439 - INFO - {'type': 'behavior_instance', 'metadata': {'type': 'instance_metadata', 'name': '0x001788010e76e184'}, 'script_id': '67d9395b-4403-42cc-b5f0-740b699d67c6', 'enabled': True, 'configuration': {'device': {'rtype': 'device', 'rid': '10feb4b2-d87e-4006-acee-28071c1c7448'}, 'buttons': {'09f56e1a-f366-5841-9c74-43b2551a1de7': {'where': [{'group': {'rtype': 'room', 'rid': 'ed0c2b14-5c37-50a3-b389-829021798ac3'}}], 'on_short_release': {'time_based_extended': {'slots': [{'start_time': {'hour': 7, 'minute': 0}, 'actions': [{'action': {'recall': {'rtype': 'scene', 'rid': '34dec36c-05f2-47f3-8a06-84cf227e380a'}}}]}, {'start_time': {'hour': 20, 'minute': 0}, 'actions': [{'action': {'recall': {'rtype': 'scene', 'rid': '0d4694d8-fef6-4635-97cc-b6fa5566aa52'}}}]}, {'start_time': {'hour': 23, 'minute': 0}, 'actions': [{'action': {'recall': {'rtype': 'scene', 'rid': 'a11e92a2-f461-4463-98f5-a657255a5d48'}}}]}], 'repeat_timeout': {'seconds': 3}, 'with_off': {'enabled': True}}}, 'on_long_press': {'action': 'do_nothing'}}, 'd4e2f610-4e10-53b1-8571-a8b43f490d52': {'where': [{'group': {'rtype': 'room', 'rid': 'ed0c2b14-5c37-50a3-b389-829021798ac3'}}], 'on_repeat': {'action': 'dim_up'}}, 'd0c5914f-d87d-5a8a-9a3d-3dea36d2796d': {'where': [{'group': {'rtype': 'room', 'rid': 'ed0c2b14-5c37-50a3-b389-829021798ac3'}}], 'on_repeat': {'action': 'dim_down'}}, '0b736dfb-4b2e-5ec0-acf7-a2ed81822a1b': {'where': [{'group': {'rtype': 'room', 'rid': 'ed0c2b14-5c37-50a3-b389-829021798ac3'}}], 'on_short_release': {'scene_cycle_extended': {'with_off': {'enabled': False}, 'repeat_timeout': {'seconds': 3}, 'slots': [[{'action': {'recall': {'rtype': 'scene', 'rid': '77904892-2bf1-420b-9edc-71665f51f4b7'}}}], [{'action': {'recall': {'rtype': 'scene', 'rid': 'b541eb00-cb90-4997-949b-73d2133415cb'}}}], [{'action': {'recall': {'rtype': 'scene', 'rid': '0d4694d8-fef6-4635-97cc-b6fa5566aa52'}}}], [{'action': {'recall': {'rtype': 'scene', 'rid': 'a11e92a2-f461-4463-98f5-a657255a5d48'}}}], [{'action': {'recall': {'rtype': 'scene', 'rid': '77904892-2bf1-420b-9edc-71665f51f4b7'}}}]]}}, 'on_long_press': {'action': 'do_nothing'}}}, 'rotaries': {}, 'model_id': 'RWL022'}}
[2024-11-24 18:20:02,337] ERROR in app: Exception on /clip/v2/resource/behavior_instance [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/flask_restful/__init__.py", line 467, in wrapper
    resp = resource(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/flask/views.py", line 84, in view
    return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
2024-11-24 18:20:02,344 - HueObjects.BehaviorInstance - 32 - INFO - 0x001788010e76e184 behaviour instance was destroyed.
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/flask_restful/__init__.py", line 582, in dispatch_request
    resp = meth(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hue-emulator/flaskUI/v2restapi.py", line 501, in post
    newObject = BehaviorInstance.BehaviorInstance(postDict)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hue-emulator/HueObjects/BehaviorInstance.py", line 19, in __init__
    "data": [self.getV2Api()],
             ^^^^^^^^^^^^^^^
  File "/opt/hue-emulator/HueObjects/BehaviorInstance.py", line 51, in getV2Api
    for resource in self.configuration["where"]:
                    ~~~~~~~~~~~~~~~~~~^^^^^^^^^
KeyError: 'where'
2024-11-24 18:20:02,346 - werkzeug - 225 - INFO - 192.168.1.119 - - [24/Nov/2024 18:20:02] "POST /clip/v2/resource/behavior_instance HTTP/1.1" 500 -

I'm not sure what steps to take to debug this further.

Errorlog:

2024-11-24 18:17:42,596 - flaskUI.v2restapi - 439 - INFO - {'type': 'behavior_instance', 'metadata': {'type': 'instance_metadata', 'name': '0x001788010e76e184'}, 'script_id': '67d9395b-4403-42cc-b5f0-740b699d67c6', 'enabled': True, 'configuration': {'device': {'rtype': 'device', 'rid': '10feb4b2-d87e-4006-acee-28071c1c7448'}, 'buttons': {'09f56e1a-f366-5841-9c74-43b2551a1de7': {'where': [{'group': {'rtype': 'room', 'rid': 'ed0c2b14-5c37-50a3-b389-829021798ac3'}}], 'on_short_release': {'time_based_extended': {'slots': [{'start_time': {'hour': 7, 'minute': 0}, 'actions': [{'action': {'recall': {'rtype': 'scene', 'rid': '34dec36c-05f2-47f3-8a06-84cf227e380a'}}}]}, {'start_time': {'hour': 20, 'minute': 0}, 'actions': [{'action': {'recall': {'rtype': 'scene', 'rid': '0d4694d8-fef6-4635-97cc-b6fa5566aa52'}}}]}, {'start_time': {'hour': 23, 'minute': 0}, 'actions': [{'action': {'recall': {'rtype': 'scene', 'rid': 'a11e92a2-f461-4463-98f5-a657255a5d48'}}}]}], 'repeat_timeout': {'seconds': 3}, 'with_off': {'enabled': True}}}, 'on_long_press': {'action': 'do_nothing'}}, 'd4e2f610-4e10-53b1-8571-a8b43f490d52': {'where': [{'group': {'rtype': 'room', 'rid': 'ed0c2b14-5c37-50a3-b389-829021798ac3'}}], 'on_repeat': {'action': 'dim_up'}}, 'd0c5914f-d87d-5a8a-9a3d-3dea36d2796d': {'where': [{'group': {'rtype': 'room', 'rid': 'ed0c2b14-5c37-50a3-b389-829021798ac3'}}], 'on_repeat': {'action': 'dim_down'}}, '0b736dfb-4b2e-5ec0-acf7-a2ed81822a1b': {'where': [{'group': {'rtype': 'room', 'rid': 'ed0c2b14-5c37-50a3-b389-829021798ac3'}}], 'on_short_release': {'scene_cycle_extended': {'with_off': {'enabled': False}, 'repeat_timeout': {'seconds': 3}, 'slots': [[{'action': {'recall': {'rtype': 'scene', 'rid': '77904892-2bf1-420b-9edc-71665f51f4b7'}}}], [{'action': {'recall': {'rtype': 'scene', 'rid': 'b541eb00-cb90-4997-949b-73d2133415cb'}}}], [{'action': {'recall': {'rtype': 'scene', 'rid': '0d4694d8-fef6-4635-97cc-b6fa5566aa52'}}}], [{'action': {'recall': {'rtype': 'scene', 'rid': 'a11e92a2-f461-4463-98f5-a657255a5d48'}}}], [{'action': {'recall': {'rtype': 'scene', 'rid': '77904892-2bf1-420b-9edc-71665f51f4b7'}}}]]}}, 'on_long_press': {'action': 'do_nothing'}}}, 'rotaries': {}, 'model_id': 'RWL022'}}
2024-11-24 18:17:42,603 - HueObjects.BehaviorInstance - 32 - INFO - 0x001788010e76e184 behaviour instance was destroyed.
2024-11-24 18:17:42,604 - werkzeug - 225 - INFO - 192.168.1.119 - - [24/Nov/2024 18:17:42] "POST /clip/v2/resource/behavior_instance HTTP/1.1" 500 -

Steps to reproduce

Might be specific to my set up, but to reproduce I:

Please enter your operating system details here

Hue-Emulator Version: 2024-11-24 13:10:00.000000000 +0100 WebUI Version: 2024-11-17 22:43:13.000000000 +0100 Architecture: aarch64 OS: Linux Linux version: #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24) Linux release: 6.1.0-rpi7-rpi-v8 Hardware: %Hardware%

Upload debug tar

This can be downloaded from the webUI.
DiyHue > Bridge > Brdige Control > Download debug > Full debug
Do not upload from Force config dump, Force config dump contains sensitive information

Uploaded the config_debug.tar, but renamed as .zip as Github doesn't support .tar config_debug(1).zip

What DiyHue version(branch) are you using?

master (latest)

hendriksen-mark commented 3 days ago

Hi, this is currently in development and not fully working. You can try the dev branch, there is the development in progress.

OACDesigns commented 3 days ago

Thanks, I'll give it a go