diyhue / diyHue

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

Can't connect to the app #809

Closed jclsn closed 2 years ago

jclsn commented 2 years ago

Describe the issue

I can't connect to the Hue app, although I am pressing the link button in the WebUI. The original Hue app says nothing and Hue Essentials says "Can't reach the bridge. Check internet connection!", although the internet is fine. I have to say that I installed this on HomeAssistant.

Steps you tried

I have tried settings some switches in the config file, but that broke even more.

How we can help

Hopefully narrow down what the issue is

Logs

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: diyHue Beta
 Philips Hue Bridge Emulator BETA
-----------------------------------------------------------
 Add-on version: 1.5.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 7.6  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2022.4.5
 Home Assistant Supervisor: 2022.04.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
/config/diyhue exists.
Your Architecture is = aarch64
Serve HTTPS
2022-04-19 21:21:11,137 - configManager.argumentHandler - INFO - Using Host 192.168.184.71:80
2022-04-19 21:21:11,138 - configManager.argumentHandler - INFO - Host MAC given as AAAAAAAAAAAA
2022-04-19 21:21:11,138 - configManager.argumentHandler - INFO - IP range for light discovery: 0-255
2022-04-19 21:21:11,138 - configManager.argumentHandler - INFO - Deconz IP given as 192.168.184.72
2022-04-19 21:21:11,138 - configManager.argumentHandler - INFO - Online Discovery/Remote API Enabled!
2022-04-19 21:21:11,146 - configManager.argumentHandler - INFO - Using Host 192.168.184.71:80
2022-04-19 21:21:11,146 - configManager.argumentHandler - INFO - Host MAC given as AAAAAAAAAAAA
2022-04-19 21:21:11,147 - configManager.argumentHandler - INFO - IP range for light discovery: 0-255
2022-04-19 21:21:11,147 - configManager.argumentHandler - INFO - Deconz IP given as 192.168.184.72
2022-04-19 21:21:11,147 - configManager.argumentHandler - INFO - Online Discovery/Remote API Enabled!
2022-04-19 21:21:11,147 - configManager.argumentHandler - INFO - Debug logging enabled!
2022-04-19 21:21:11,194 - configManager.configHandler - INFO - Config loaded
2022-04-19 21:21:11,492 - functions.daylightSensor - DEBUG - Daylight Sensor: location is not configured
Starting remote discovery
2022-04-19 21:21:11,496 - services.stateFetch - INFO - start lights sync
2022-04-19 21:21:11,498 - services.ssdp - INFO - start ssdp broadcast
2022-04-19 21:21:11,499 - services.mdns - INFO - <MDNS> listener started
2022-04-19 21:21:11,507 - services.eventStreamer - DEBUG - {'creationtime': '2022-04-19T19:21:11Z', 'data': [{'children': [], 'grouped_services': [{'rid': '8f4d0610-ca24-4fc6-9902-b5edba664df4', 'rtype': 'grouped_light'}], 'services': [{'rid': '8f4d0610-ca24-4fc6-9902-b5edba664df4', 'rtype': 'grouped_light'}], 'id': 'ebdcf52d-75e3-57c4-9105-26ef82c9ca78', 'id_v1': '/groups/0', 'metadata': {'archetype': 'other', 'name': 'Group 0'}, 'type': 'zone'}], 'id': '8b838f8c-11a9-4dbf-90f8-b530f8b6efb7', 'type': 'add'}
 * 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
2022-04-19 21:21:11,514 - services.ssdp - INFO - starting ssdp...
 * Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://192.168.184.71:80/ (Press CTRL+C to quit)
Exception in thread Thread-10:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/hue-emulator/HueEmulator3.py", line 94, in runHttps
    ctx.load_cert_chain(certfile=CONFIG_PATH + "/cert.pem")
ssl.SSLError: [SSL] PEM lib (_ssl.c:4023)
192.168.184.51 - - [19/Apr/2022 21:21:12] "GET /description.xml HTTP/1.1" 200 -
192.168.184.51 - - [19/Apr/2022 21:21:12] "GET /description.xml HTTP/1.1" 200 -
192.168.184.30 - - [19/Apr/2022 21:21:15] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -
192.168.184.30 - - [19/Apr/2022 21:21:20] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -

Docker Info (please complete the following information):

Checklist

Additional context

mariusmotea commented 2 years ago

Probably you don't set the MAC env variable correctly and the ssl certificate was not generated successfully. You can check if there is content in cert.pem file from the config directory. P.S. Start using the master branch. Beta was moved in the master and already contain additional fixes.

jclsn commented 2 years ago

I thought I could just use some MAC address. What do I need to put? Home assistant seems to create virtual ethernet devices for its addons. I don't suppose taking the one from the actually PHY is correct.

The other issue is that the beta version is the only one that works on Home Assistant. There is a master version as well, but it can't be installed and the project doesn't seem to be maintained anymore. I also don't have a spare Raspberry Pi laying around unfortunately. Here is the error message:

The command '/bin/bash -o pipefail -c mv /diyhue/BridgeEmulator/web-ui/ ./web-ui/' returned a non-zero code: 1

Would be great if you guy could maintain the HA addon. I mean it is widely used. It should be a Docker container as all HA addons. Haven't looked at the code yet.

EDIT: Okay, I just did. The installation of the files is not correct: https://github.com/maxbec/hassio-diyHue/blob/86078be2821c353d1044c6ce6929c8755f9143b3/diyhue/Dockerfile#L34

I think he should also use install instead of mv here. I am familiar with Docker, but not with DiyHue. So no idea what the is trying. The beta version's Dockerfile looks quite different as well.

mariusmotea commented 2 years ago

@maxbec Can you update the HA manifest? The master version need to be now like the beta one.

@jclsn you need to specify the MAC address that the apps saw when they connect to the "bridge" so it need to be the mac of the Raspberry PI main interface.

jclsn commented 2 years ago

@mariusmotea He has not responded to any issues so far. Don't think he will now. I could try to fork and fix it, but actually I have too many projects atm... My head will explode at some point haha.

What do you mean by "the MAC that the apps saw"? I can choose whatever MAC address and this will be seen in the app. You mean the MAC of the Conbee stick? I already tried the one from the WLAN and Ethernet adapters...

grafik

mariusmotea commented 2 years ago

Official Hue apps validate the certificate by inspecting the CN field (that is Mac based generated) and compare it with the Mac address of the device he connect. If he connect to a device with docker containers, the app see the Mac of that device, not the Mac inside the containers. You can ping your raspberry pi from any device from the network and then inspect the ARP table to see what MAC he learned for that IP. If you can fix the master manifest it will be also appreciated since lot of users use HAAS.

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.

jclsn commented 2 years ago

@mariusmotea Yeah, so I could fix the Dockerfile with this commit https://github.com/maxbec/hassio-diyHue/pull/49

I still have the same issues as before although I used the MAC that I got when using arping on my Pi. Hue Essentials says "Can't reach the bridge. Please check the internet connection."

Here is the log

-----------------------------------------------------------
 Add-on: diyHue
 Philips Hue Bridge Emulator
-----------------------------------------------------------
 Add-on version: 1.5.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 7.6  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2022.4.7
 Home Assistant Supervisor: 2022.04.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
/config/diyhue exists.
Your Architecture is = aarch64
Serve HTTPS
2022-05-01 22:08:37,234 - configManager.argumentHandler - INFO - Using Host 192.168.184.71:80
2022-05-01 22:08:37,235 - configManager.argumentHandler - INFO - Host MAC given as e45f0126b335
2022-05-01 22:08:37,235 - configManager.argumentHandler - INFO - IP range for light discovery: 0-255
2022-05-01 22:08:37,235 - configManager.argumentHandler - INFO - Deconz IP given as 127.0.0.1
2022-05-01 22:08:37,236 - configManager.argumentHandler - INFO - Online Discovery/Remote API Enabled!
2022-05-01 22:08:37,244 - configManager.argumentHandler - INFO - Using Host 192.168.184.71:80
2022-05-01 22:08:37,244 - configManager.argumentHandler - INFO - Host MAC given as e45f0126b335
2022-05-01 22:08:37,245 - configManager.argumentHandler - INFO - IP range for light discovery: 0-255
2022-05-01 22:08:37,245 - configManager.argumentHandler - INFO - Deconz IP given as 127.0.0.1
2022-05-01 22:08:37,245 - configManager.argumentHandler - INFO - Online Discovery/Remote API Enabled!
2022-05-01 22:08:37,247 - configManager.argumentHandler - INFO - Debug logging disabled!
2022-05-01 22:08:37,358 - configManager.configHandler - INFO - Config loaded
Starting remote discovery
2022-05-01 22:08:37,713 - services.stateFetch - INFO - start lights sync
2022-05-01 22:08:37,716 - services.ssdp - INFO - starting ssdp...
2022-05-01 22:08:37,718 - services.ssdp - INFO - start ssdp broadcast
2022-05-01 22:08:37,724 - 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
Exception in thread Thread-10:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
 * Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
    self.run() * Running on http://192.168.184.71:80/ (Press CTRL+C to quit)
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/hue-emulator/HueEmulator3.py", line 94, in runHttps
    ctx.load_cert_chain(certfile=CONFIG_PATH + "/cert.pem")
ssl.SSLError: [SSL] PEM lib (_ssl.c:4023)
192.168.184.30 - - [01/May/2022 22:08:41] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -
192.168.184.30 - - [01/May/2022 22:08:46] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -
2022-05-01 22:08:48,747 - services.stateFetch - INFO - start lights sync
192.168.184.30 - - [01/May/2022 22:08:51] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -
192.168.184.30 - - [01/May/2022 22:08:56] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -
192.168.184.30 - - [01/May/2022 22:09:01] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -
2022-05-01 22:09:02,776 - services.stateFetch - INFO - start lights sync
192.168.184.30 - - [01/May/2022 22:09:06] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -
192.168.184.30 - - [01/May/2022 22:09:11] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -
2022-05-01 22:09:13,786 - services.stateFetch - INFO - start lights sync
192.168.184.30 - - [01/May/2022 22:09:16] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -
192.168.184.30 - - [01/May/2022 22:09:21] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -
192.168.184.30 - - [01/May/2022 22:09:26] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -
2022-05-01 22:09:27,815 - services.stateFetch - INFO - start lights sync
192.168.184.30 - - [01/May/2022 22:09:28] "GET / HTTP/1.1" 200 -
192.168.184.30 - - [01/May/2022 22:09:28] "GET /static/css/3.482bc700.chunk.css HTTP/1.1" 304 -
192.168.184.30 - - [01/May/2022 22:09:28] "GET /static/css/main.68528cb4.chunk.css HTTP/1.1" 304 -
192.168.184.30 - - [01/May/2022 22:09:28] "GET /static/js/3.c5e1b835.chunk.js HTTP/1.1" 304 -
192.168.184.30 - - [01/May/2022 22:09:28] "GET /static/js/main.b9a496a8.chunk.js HTTP/1.1" 304 -
192.168.184.30 - - [01/May/2022 22:09:28] "GET /static/media/logo.f4d77638.svg HTTP/1.1" 304 -
192.168.184.30 - - [01/May/2022 22:09:28] "GET /static/js/12.fb508b4e.chunk.js HTTP/1.1" 304 -
192.168.184.30 - - [01/May/2022 22:09:28] "GET /get-key HTTP/1.1" 200 -
192.168.184.30 - - [01/May/2022 22:09:28] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -
192.168.184.54 - - [01/May/2022 22:09:31] "GET /api/config HTTP/1.1" 200 -
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
192.168.184.54 - - [01/May/2022 22:09:33] "POST /api/ HTTP/1.1" 200 -
192.168.184.30 - - [01/May/2022 22:09:33] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
192.168.184.54 - - [01/May/2022 22:09:34] "POST /api/ HTTP/1.1" 200 -
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
192.168.184.54 - - [01/May/2022 22:09:35] "POST /api/ HTTP/1.1" 200 -
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
192.168.184.54 - - [01/May/2022 22:09:36] "POST /api/ HTTP/1.1" 200 -
[{'success': {'/config/linkbutton': {'lastlinkbuttonpushed': 1651435777}}}]
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
[{'success': {'clientkey': '5F4C4A6178704CC299756DA7472BC256',
              'username': 'hueess48c98a11ec9223e45f0126b335'}}]
192.168.184.30 - - [01/May/2022 22:09:38] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -
2022-05-01 22:09:38,819 - services.stateFetch - INFO - start lights sync
192.168.184.30 - - [01/May/2022 22:09:39] "PUT /api/c7264b64c01311eca639e45f0126b335/config HTTP/1.1" 200 -
192.168.184.54 - - [01/May/2022 22:09:39] "POST /api/ HTTP/1.1" 200 -
192.168.184.30 - - [01/May/2022 22:09:43] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -
192.168.184.30 - - [01/May/2022 22:09:48] "GET /api/c7264b64c01311eca639e45f0126b335/groups/0 HTTP/1.1" 200 -
2022-05-01 22:09:49,832 - services.stateFetch - INFO - start lights sync
mariusmotea commented 2 years ago

ssl.SSLError: [SSL] PEM lib (_ssl.c:4023) means there is not content in the certificate file. Most likely you specified the MAC wrong? Try to avoid uppercase characters.

mariusmotea commented 2 years ago

or the script that generate the certificate is wrong executed.

jclsn commented 2 years ago

I wouldn't know how to fix that. The developer of the addon also said SSL is not supported on HA. I get the same error when message when checking "no serve https" though.

Mevel commented 2 years ago

SSL not supported is in regard to the web ui. Marius is referring to the certificate for authenticating the emulator as a real bridge.

We will launch a official hassio diyhue addon in the next days.

chillkiller commented 2 years ago

If yours really launch an official/community diyhue addon for HA this will be awesome!!!

jclsn commented 2 years ago

@Mevel Okay, than it is not worth the trouble to try to fix this. Really looking forward to this addon! It will make my Home Assistant capable of using any light source for HueSync. Awesome!

schumi2004 commented 1 year ago

For what's it worth I was facing the same issue. I'm 100% sure the MAC addres is correct (not sure it should be written in lower or upper case?) Anyway, i could connect succesfully when doing a manual connection and selecting diyhue, directly connecting to the automaticly found bridge did not work.

Now i'm going to try if my Philips android TV can establish a connection with build in Hue functionality.

/edit: I was wrong. Initially it connected but fails afterwards.