Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recurrent crash of the app over missing bri key #1043

Closed
azukaar opened this issue Sep 7, 2024 · 5 comments
Closed

Recurrent crash of the app over missing bri key #1043

azukaar opened this issue Sep 7, 2024 · 5 comments

Comments

@azukaar
Copy link

azukaar commented Sep 7, 2024

Issue does not already exist?

I have searched and found no existing issue

Select Environment

Docker

Home Assistant related?

Yes

Description

The error appears pretty much every day after a while, causing the whole system to fall appart. i could not identify specific patterns

Errorlog:

2024-09-07 01:48:52,883 - flaskUI.v2restapi - 609 - INFO - {'is_at_home': False, 'name': 'aiohue_dlgjqurbzz'}
2024-09-07 01:48:52,884 - flaskUI.v2restapi - 53 - INFO - element not found!
2024-09-07 01:48:52,885 - werkzeug - 225 - INFO - 192.168.1.214 - - [07/Sep/2024 01:48:52] "PUT /clip/v2/resource/geofence_client/a2fda02e-2017-56fd-b2cf-ef15988f3b89 HTTP/1.1" 200 -
[2024-09-07 01:48:53,392] ERROR in app: Exception on /clip/v2/resource [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-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.8/site-packages/flask_restful/__init__.py", line 467, in wrapper
    resp = resource(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask/views.py", line 84, in view
    return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask_restful/__init__.py", line 582, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/opt/hue-emulator/flaskUI/v2restapi.py", line 285, in get
    data.append(group.getV2GroupedLight())
  File "/opt/hue-emulator/HueObjects/Group.py", line 287, in getV2GroupedLight
    result["dimming"] = {"brightness": self.update_state()["avr_bri"]}
  File "/opt/hue-emulator/HueObjects/Group.py", line 140, in update_state
    bri = bri + light().state["bri"]
KeyError: 'bri'
2024-09-07 01:48:53,399 - werkzeug - 225 - INFO - 192.168.1.202 - - [07/Sep/2024 01:48:53] "GET /clip/v2/resource HTTP/1.1" 500 -
2024-09-07 01:48:54,085 - services.stateFetch - 12 - INFO - start lights sync
2024-09-07 01:48:54,335 - werkzeug - 225 - INFO - 192.168.1.202 - - [07/Sep/2024 01:48:54] "GET /clip/v2/resource/bridge HTTP/1.1" 200 -
2024-09-07 01:48:54,356 - werkzeug - 225 - INFO - 192.168.1.202 - - [07/Sep/2024 01:48:54] "GET /eventstream/clip/v2 HTTP/1.1" 200 -
[2024-09-07 01:48:54,382] ERROR in app: Exception on /clip/v2/resource [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-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.8/site-packages/flask_restful/__init__.py", line 467, in wrapper
    resp = resource(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask/views.py", line 84, in view
    return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask_restful/__init__.py", line 582, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/opt/hue-emulator/flaskUI/v2restapi.py", line 285, in get
    data.append(group.getV2GroupedLight())
  File "/opt/hue-emulator/HueObjects/Group.py", line 287, in getV2GroupedLight
    result["dimming"] = {"brightness": self.update_state()["avr_bri"]}
  File "/opt/hue-emulator/HueObjects/Group.py", line 140, in update_state
    bri = bri + light().state["bri"]
KeyError: 'bri'
2024-09-07 01:48:54,384 - werkzeug - 225 - INFO - 192.168.1.202 - - [07/Sep/2024 01:48:54] "GET /clip/v2/resource HTTP/1.1" 500 -
2024-09-07 01:48:55,304 - werkzeug - 225 - INFO - 192.168.1.202 - - [07/Sep/2024 01:48:55] "GET /clip/v2/resource/bridge HTTP/1.1" 200 -
2024-09-07 01:48:55,320 - werkzeug - 225 - INFO - 192.168.1.202 - - [07/Sep/2024 01:48:55] "GET /eventstream/clip/v2 HTTP/1.1" 200 -
2024-09-07 01:48:56,391 - werkzeug - 225 - INFO - 192.168.1.202 - - [07/Sep/2024 01:48:56] "GET /api/config HTTP/1.1" 200 -
2024-09-07 01:49:02,796 - werkzeug - 225 - INFO - 192.168.1.225 - - [07/Sep/2024 01:49:02] "GET /auth/v1 HTTP/1.1" 200 -
[2024-09-07 01:49:05,376] ERROR in app: Exception on /clip/v2/resource [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-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.8/site-packages/flask_restful/__init__.py", line 467, in wrapper
    resp = resource(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask/views.py", line 84, in view
    return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask_restful/__init__.py", line 582, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/opt/hue-emulator/flaskUI/v2restapi.py", line 285, in get
    data.append(group.getV2GroupedLight())
  File "/opt/hue-emulator/HueObjects/Group.py", line 287, in getV2GroupedLight
    result["dimming"] = {"brightness": self.update_state()["avr_bri"]}
  File "/opt/hue-emulator/HueObjects/Group.py", line 140, in update_state
    bri = bri + light().state["bri"]
KeyError: 'bri'
2024-09-07 01:49:05,381 - werkzeug - 225 - INFO - 192.168.1.202 - - [07/Sep/2024 01:49:05] "GET /clip/v2/resource HTTP/1.1" 500 -
2024-09-07 01:49:05,686 - flaskUI.v2restapi - 609 - INFO - {'is_at_home': False, 'name': 'aiohue_vmezhatchd'}
2024-09-07 01:49:05,688 - flaskUI.v2restapi - 53 - INFO - element not found!
2024-09-07 01:49:05,692 - werkzeug - 225 - INFO - 192.168.1.214 - - [07/Sep/2024 01:49:05] "PUT /clip/v2/resource/geofence_client/23677398-6456-5002-9f2d-43ac51a33cf9 HTTP/1.1" 200 -
2024-09-07 01:49:06,346 - werkzeug - 225 - INFO - 192.168.1.202 - - [07/Sep/2024 01:49:06] "GET /clip/v2/resource/bridge HTTP/1.1" 200 -
2024-09-07 01:49:06,373 - werkzeug - 225 - INFO - 192.168.1.202 - - [07/Sep/2024 01:49:06] "GET /eventstream/clip/v2 HTTP/1.1" 200 -
[2024-09-07 01:49:06,405] ERROR in app: Exception on /clip/v2/resource [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-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.8/site-packages/flask_restful/__init__.py", line 467, in wrapper
    resp = resource(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask/views.py", line 84, in view
    return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask_restful/__init__.py", line 582, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/opt/hue-emulator/flaskUI/v2restapi.py", line 285, in get
    data.append(group.getV2GroupedLight())
  File "/opt/hue-emulator/HueObjects/Group.py", line 287, in getV2GroupedLight
    result["dimming"] = {"brightness": self.update_state()["avr_bri"]}
  File "/opt/hue-emulator/HueObjects/Group.py", line 140, in update_state
    bri = bri + light().state["bri"]
KeyError: 'bri'

Steps to reproduce

DIYHue + Homeassistant with hue lights only

Please enter your operating system details here

Hue-Emulator Version: 2024-08-28 01:06:42.000000000
WebUI Version: 2024-08-28 01:06:50.000000000
Architecture: aarch64
OS: Linux
Linux version: #1 SMP PREEMPT Tue Jun 18 13:49:00 UTC 2024
Linux release: 6.6.33-haos
Hardware: %Hardware%

Upload debug tar

Github does not allow tar items to be uploaded

What DiyHue version(branch) are you using?

master (latest)

@azukaar
Copy link
Author

azukaar commented Sep 7, 2024

Desktop.zip

Zipped the debug stuff instead as .tar is not allowed by GH

@hendriksen-mark
Copy link
Member

Hi, thank you for reporting this. i will make some changes to fix this.

hendriksen-mark added a commit that referenced this issue Sep 21, 2024
update credits.
update diyhue response in v2api.
update time routine.
add timer routine.
update mdns name.
Accessories name change fix,
update groups and lights event stream.
update sensor v2api response.
update openwrt install.
#1041
#1043
https://diyhue.discourse.group/t/diyhue-installation-on-openwrt-fails/760
#1046
@hendriksen-mark
Copy link
Member

hi, i made changes to fix this. please try and give feedback.

@azukaar
Copy link
Author

azukaar commented Sep 21, 2024

Updating, will keep you informed, thanks you! (the crash would typically happen after a few hours so I'll monitor the service)

@azukaar
Copy link
Author

azukaar commented Sep 25, 2024

This seems to have fixed the issue, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants