diyhue / diyHue

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

Exception connecting with philips hue app(3) #718

Closed flash447 closed 2 years ago

flash447 commented 2 years ago

Describe the bug

(This is a copy of #713 since I don't have access to add comments to that issue) Exception connecting with philips hue app

Steps to Reproduce

I have setup diyHue with the latest from the beta branch. Initially, I was able to connect with the Philips hue app and setup my lights and it seemed to work. But now when I connect, the hue app stalls and hue emulator generates the following exception over and over:

2021-10-24 08:50:29,328 - configManager.argumentHandler - INFO - Using Host 192.168.10.2:80
2021-10-24 08:50:29,349 - configManager.argumentHandler - INFO - Host MAC given as 00c0ba32d190
2021-10-24 08:50:29,349 - configManager.argumentHandler - INFO - IP range for light discovery: 0-255
2021-10-24 08:50:29,350 - configManager.argumentHandler - INFO - Deconz IP given as 127.0.0.1
2021-10-24 08:50:29,350 - configManager.argumentHandler - INFO - Online Discovery/Remote API Enabled!
2021-10-24 08:50:29,354 - configManager.argumentHandler - INFO - Debug logging disabled!
2021-10-24 07:50:30,374 - configManager.configHandler - INFO - Config loaded
Starting remote discovery
2021-10-24 07:50:30,769 - services.stateFetch - INFO - start lights sync
2021-10-24 07:50:30,777 - services.ssdp - INFO - starting ssdp...
2021-10-24 07:50:30,779 - services.ssdp - INFO - start ssdp broadcast
2021-10-24 07:50:30,780 - services.mdns - INFO - <MDNS> listener started
 * Serving Flask app "HueEmulator3" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
 * Serving Flask app "HueEmulator3" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on https://0.0.0.0:443/ (Press CTRL+C to quit)
192.168.10.45 - - [24/Oct/2021 07:50:39] "GET /clip/v2/resource/bridge HTTP/1.1" 200 -
192.168.10.45 - - [24/Oct/2021 07:50:40] "GET /eventstream/clip/v2 HTTP/1.1" 200 -
[2021-10-24 07:50:40,760] ERROR in app: Exception on /clip/v2/resource [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.7/dist-packages/flask_restful/__init__.py", line 468, in wrapper
    resp = resource(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/flask/views.py", line 89, in view
    return self.dispatch_request(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/flask_restful/__init__.py", line 583, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/opt/hue-emulator/flaskUI/v2restapi.py", line 210, in get
    data.append(light.getV2Api())
  File "/opt/hue-emulator/HueObjects/__init__.py", line 307, in getV2Api
    "mirek": self.state["ct"] if self.state["colormode"] == "ct" else None,
KeyError: 'colormode'

I have the following lights: 1x Ubisys Universal dimmer D1 (dimmable) 1x Philips LCT015 (RGB, dimmable) 6x Innr Adapter plug SP 120 (on/off switch, non-dimmable)

Expected behavior

Not crashing :)

Logs

None.

Docker Info (please complete the following information):

Non docker installation. But I doubt my issue is related to this.

Checklist

Additional context

None.

arecdudek commented 2 years ago

I have similar problem on HomeAssistant diyHue beta version:

192.168.1.13 - - [27/Oct/2021 17:11:32] "GET /api/425e88ae373511ecaee6b827eb9807c1/groups/0 HTTP/1.1" 200 - 2021-10-27 17:11:32,638 - services.ssdp - DEBUG - Sending M-Search response to 192.168.1.10 192.168.1.13 - - [27/Oct/2021 17:11:33] "GET /lights HTTP/1.1" 200 - 2021-10-27 17:11:34,723 - services.stateFetch - INFO - start lights sync 2021-10-27 17:11:34,724 - services.stateFetch - DEBUG - fetch Yeelight ceiling1 .18 2021-10-27 17:11:34,742 - services.stateFetch - DEBUG - {'on': False, 'bri': 116, 'ct': 333, 'colormode': 'ct'} 2021-10-27 17:11:34,743 - services.stateFetch - DEBUG - fetch Sypialnia {'stream': {'active': False}} 2021-10-27 17:11:35,047 - flaskUI.restful - INFO - stop hue entertainent [2021-10-27 17:11:35,067] ERROR in app: Exception on /api/5f1d88a4373611ecaee6b827eb9807c1/groups/3 [PUT] Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request return self.view_functionsrule.endpoint File "/usr/local/lib/python3.8/site-packages/flask_restful/init.py", line 468, in wrapper resp = resource(*args, kwargs) File "/usr/local/lib/python3.8/site-packages/flask/views.py", line 89, in view return self.dispatch_request(*args, *kwargs) File "/usr/local/lib/python3.8/site-packages/flask_restful/init.py", line 583, in dispatch_request resp = meth(args, kwargs) File "/opt/hue-emulator/flaskUI/restful.py", line 349, in put bridgeConfig[resource][resourceid].update_attr(putDict) AttributeError: 'EntertainmentConfiguration' object has no attribute 'update_attr' 192.168.1.10 - - [27/Oct/2021 17:11:35] "PUT /api/5f1d88a4373611ecaee6b827eb9807c1/groups/3 HTTP/1.1" 500 -

mariusmotea commented 2 years ago

Thanks, will fix this in few moments

arecdudek commented 2 years ago

@mariusmotea I reinstaled this addon few times, and I fixed it after few hours. I just generate new another mac address and regenerate certificate. It looks like something is remember connected lights to old mac address. If you had problem in the past you will also have it after reinstall (without changing mac address). But now sometimes it drops connection with one lamp and it stay in different color than ambilight on TV.

arehsan commented 2 years ago

Hi,

I get the same error message with latest docker beta. Using zigbee2mqtt and several types of lights, LTW001, LWB010 and LST002. Hue app did work earlier, but is now unable to connect. If I reset the app (official hue app on iOS), the bridge is recognized and linked, but stuck on "connecting..."

mariusmotea commented 2 years ago

Hi,

I get the same error message with latest docker beta. Using zigbee2mqtt and several types of lights, LTW001, LWB010 and LST002. Hue app did work earlier, but is now unable to connect. If I reset the app (official hue app on iOS), the bridge is recognized and linked, but stuck on "connecting..."

Cannot be the same error since this was fixed.

flash447 commented 2 years ago

I also still have the same issue running with the latest beta. In what commit id was it suppose to be fixed?

mariusmotea commented 2 years ago

Please paste here the error from the logs.

flash447 commented 2 years ago

[2022-01-04 10:16:58,613] ERROR in app: Exception on /clip/v2/resource [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.7/dist-packages/flask_restful/__init__.py", line 468, in wrapper
    resp = resource(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/flask/views.py", line 89, in view
    return self.dispatch_request(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/flask_restful/__init__.py", line 583, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/opt/hue-emulator/flaskUI/v2restapi.py", line 210, in get
    data.append(light.getV2Api())
  File "/opt/hue-emulator/HueObjects/__init__.py", line 307, in getV2Api
    "mirek": self.state["ct"] if self.state["colormode"] == "ct" else None,
KeyError: 'colormode'
arehsan commented 2 years ago
10.0.0.93 - - [04/Jan/2022 11:49:17] "GET /clip/v2/resource/bridge HTTP/1.1" 200 -
10.0.0.93 - - [04/Jan/2022 11:49:17] "GET /eventstream/clip/v2 HTTP/1.1" 200 -
[2022-01-04 11:49:17,128] ERROR in app: Exception on /clip/v2/resource [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.9/dist-packages/flask_restful/__init__.py", line 468, in wrapper
    resp = resource(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/flask/views.py", line 89, in view
    return self.dispatch_request(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/flask_restful/__init__.py", line 583, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/opt/hue-emulator/flaskUI/v2restapi.py", line 224, in get
    data.append(light.getV2Api())
  File "/opt/hue-emulator/HueObjects/__init__.py", line 365, in getV2Api
    "mirek": self.state["ct"] if self.state["colormode"] == "ct" else None,
KeyError: 'colormode'
10.0.0.93 - - [04/Jan/2022 11:49:17] "GET /clip/v2/resource HTTP/1.1" 500 -

10.0.0.93 is my iPhone

mariusmotea commented 2 years ago

Ok, will made a new release to fix this error.

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.