diyhue / diyHue

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

No response from the link button when connecting to the Hue application #920

Closed ZajerTMF closed 9 months ago

ZajerTMF commented 11 months ago

Issue does not already exist?

No, I did not search

Select Environment

Docker

Home Assistant related?

No

Description

Hello there! I have tried installing on different devices and in Docker, but in each case, the result is the same. When trying to connect to the Hue application, a request to press the button appears, so I click the 'link app.' However, nothing happens after that. Thank you in advance for any help.

Please enter your operating system details here

Raspbian GNU/Linux 10 (buster) Kernel: 5.15.32-v7l+

What DiyHue version(branch) are you using?

master (latest)

mariusmotea commented 11 months ago

If you provided invalid mac address the https certificate failed. You can debug this using the https check from here https://diyhue.readthedocs.io/en/latest/AddFuncts/debug.html?highlight=https#https-certificate-check . On every certificate change the Hue app need to be reinstalled.

Enable debug mode — diyHue 1.0 documentation
ZajerTMF commented 11 months ago

The MAC address is correct, I've checked it several times, but still, there is no certificate available, regardless of the device and type of installation.

legovaer commented 11 months ago

For some reason I bump into this issue as well. My flow:

  1. Clean install diyHue
  2. Setup Hue Essentials (link button works)
  3. Setup bridge in official app (link button shows red error and hue Bridge never receives the pushed button event)

Even after a complete shutdown of the docker container and a re-start, there's only one thing I can do in order to make the link functionality work again: re-install.

justinknguyen commented 11 months ago

Reinstalling doesn't work for me. Seems like DiyHue no longer pairs with the official Hue app on iOS/Android on the latest versions. I’m able to pair it on Hue Essentials, Desktop Hue Sync App, Home Assistant, etc. just doesn’t work on the mobile apps anymore.

I tried pairing with version 4.30.0 of the official app on Android and it works. However, sync seems to be buggy and I can’t try any newer version because I only have Android 9.

Edit: I was using docker.

legovaer commented 11 months ago

Weird thing is: when i use the home assistant addon, it works perfect. But when I run it in a separate docker environment, i face the same issue.

Write commented 11 months ago

Same issue here. I can't try as homeassistant addon though (lack supervisor since I run ha in docker). So I use a separate docker environment for DIYHue. I can also confirm pairing instantly work with Hue essential

I can also confirm the MAC address is valid in the certificate, and checked against the container with docker network inspect (I use a macvlan setup). DIYHue is perfectly reachable from an other host on the lan network, on port 80 and HTTPS (443) with MACVlan IP I set.

Curl snippet :

› curl https://192.168.1.68/api/nouser/config -v -k
*   Trying 192.168.1.68:443...
* Connected to 192.168.1.68 (192.168.1.68) port 443 (#0)
* ALPN: offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN: server did not agree on a protocol. Uses default.
* Server certificate:
*  subject: C=NL; O=Philips Hue; CN=0242c0fffea80144
*  start date: Aug 11 00:05:45 2023 GMT
*  expire date: Aug  8 00:05:45 2033 GMT
*  issuer: C=NL; O=Philips Hue; CN=0242c0fffea80144
*  SSL certificate verify result: self-signed certificate (18), continuing anyway.
* using HTTP/1.x
> GET /api/nouser/config HTTP/1.1
> Host: 192.168.1.68
> User-Agent: curl/7.88.1
> Accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 253
< Access-Control-Allow-Origin: *
< Server: Werkzeug/2.0.3 Python/3.11.2
< Date: Mon, 14 Aug 2023 18:33:03 GMT
<
{"name": "DiyHue Bridge", "datastoreversion": "126", "swversion": "19561788040", "apiversion": "1.56.0", "mac": "02:42:c0:a8:01:44", "bridgeid": "0242C0FFFEA80144", "factorynew": false, "replacesbridgeid": null, "modelid": "BSB002", "starterkitid": ""}
* Connection #0 to host 192.168.1.68 left intact

As stated in my future post down below, I can pair the hub just fine with the first version requiring android 10 of the Philips Hue app. (4.31.1 IIRC). I was too lazy to check after which version pairing is broken. However, I can't link the Alexa App as it throw an error after I go back to the Alexa app from the Philips Hue app linking page.

legovaer commented 11 months ago

I am currently checking the differences between the container that is deployed in HA and the container I have in my separate Docker instace.. Will report back if I find some differences.

Write commented 11 months ago

Same issue here. I can't try as homeassistant addon though (lack supervisor since I run ha in docker).

So I use a separate docker environment for DIYHue.

I can also confirm pairing instantly work with Hue essential

I can also confirm the make address is valid in the certificate, and checked against the container with docker network inspect

After multiples versions of Philips Hue apk on android, I finally could pair instantly on the first version requiring android 10. I think 4.31.1. I was too lazy to try all apk to find after which version pairing is broken.

EDIT : Hoverwer I can't link Alexa app unfortunatly.

legovaer commented 11 months ago

Interesting. Maybe it's related to the SSL certificate. Any chance you can share the apk of that specific version? Then I can do some packet tracking to see if there is any difference in the request the app makes compared with the current version.

Write commented 11 months ago

Interesting. Maybe it's related to the SSL certificate. Any chance you can share the apk of that specific version? Then I can do some packet tracking to see if there is any difference in the request the app makes compared with the current version.

Here's where I downloaded the 4.31.1 : https://philips-hue.fr.uptodown.com/android/versions

It seems to throw an error 500 on download now. You can also find older versions here : https://apkcombo.com/fr/philips-hue/com.philips.lighting.hue2/old-versions/

MarkusH1975 commented 10 months ago

Hi, I have the same issue with docker diyhue/core:916. I cannot connect with Hue App Android Version 4.49.0 (tried some older versions with same result).
Hue Essentials work fine. All 4 Hue works fine. (I used original Hue Bridge connection type.)

Website is availavle with: https://localhost/.



docker inspect diyHue | grep -i "NetworkMode"
            "NetworkMode": "host",

docker inspect diyHue | grep "MAC"
                **"MAC=c8:7f:54:01:e8:76",**


**curl https://127.0.0.1/api/nouser/config -v -k**
*   Trying 127.0.0.1:443...
* Connected to 127.0.0.1 (127.0.0.1) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (OUT), TLS header, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: C=NL; O=Philips Hue; CN=c87f54fffe01e876
*  start date: Aug 25 11:25:07 2023 GMT
*  expire date: Aug 22 11:25:07 2033 GMT
*  issuer: C=NL; O=Philips Hue; **CN=c87f54fffe01e876**
*  SSL certificate verify result: self-signed certificate (18), continuing anyway.
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> GET /api/nouser/config HTTP/1.1
> Host: 127.0.0.1
> User-Agent: curl/7.81.0
> Accept: */*
> 
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
* TLSv1.2 (IN), TLS header, Supplemental data (23):
< Content-Type: application/json
< Content-Length: 1927
< Access-Control-Allow-Origin: *
< Server: Werkzeug/2.0.3 Python/3.11.2
< Date: Fri, 25 Aug 2023 17:27:18 GMT
< 
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{"backup": {"errorcode": 0, "status": "idle"}, "datastoreversion": "126", "dhcp": true, "factorynew": false, "internetservices": {"internet": "disconnected", "remoteaccess": "disconnected", "swupdate": "disconnected", "time": "disconnected"}, "linkbutton": false, "modelid": "BSB002", "portalconnection": "disconnected", "portalservices": false, "portalstate": {"communication": "disconnected", "incoming": false, "outgoing": false, "signedon": false}, "proxyaddress": "none", "proxyport": 0, "replacesbridgeid": null, "swupdate": {"checkforupdate": false, "devicetypes": {"bridge": false, "lights": [], "sensors": []}, "notify": true, "text": "", "updatestate": 0, "url": ""}, "swupdate2": {"autoinstall": {"on": true, "updatetime": "T14:00:00"}, "bridge": {"lastinstall": "2020-12-11T17:08:55", "state": "noupdates"}, "checkforupdate": false, "lastchange": "2020-12-13T10:30:15", "state": "unknown"}, "zigbeechannel": 25, "Hue Essentials key": "9344b7f842bd11ee8bb1c87f5401e876", "Remote API enabled": false, "apiversion": "1.56.0", "bridgeid": "C87F54FFFE01E876", "ipaddress": "192.168.1.50", "netmask": "255.255.255.0", "gateway": "192.168.1.1", **"mac": "c8:7f:54:01:e8:76"**, "name": "DiyHue Bridge", "swversion": "19561788040", "timezone": "Europe/London", "UTC": "2023-08-25T17:27:18", "localtime": "2023-08-25T18:27:18", "whitelist": {"a098ce8a42bd11ee924dc87f5401e876": {"create date": "2023-08-24T20:34:08", "last use date": "2023-08-25T12:45:30", "name": "WebUi"}, "hueess2042bf11ee888cc87f5401e876": {"create date": "2023-08-24T20:41:58", "last use date": "2023-08-24T21:19:20", "name": "Hue Essentials#SM-A536B"}, "hueess8042c311eea791c87f5401e876": {"create date": "2023-08-24T21:16:24", "last use date": "2023-08-25T07:50:13", "name": "Hue Essentials#SM-A536B"}, "hueess50433b11ee9a84c87f5401e876": {"create date": "2023-08-25T11:25:07", "last use date": "2023-08-25T11:33:47", "name": "Hue Essentials#SM-A536B"}}}
* Connection #0 to host 127.0.0.1 left intact

Debug output: Mobile phone IP: 192.168.1.195


2023-08-25 19:06:13,722 - werkzeug - INFO - 127.0.0.1 - - [25/Aug/2023 19:06:13] "GET /api/a098ce8a42bd11ee924dc87f5401e876 HTTP/1.1" 200 -
2023-08-25 19:06:15,723 - werkzeug - INFO - 127.0.0.1 - - [25/Aug/2023 19:06:15] "GET /api/a098ce8a42bd11ee924dc87f5401e876 HTTP/1.1" 200 -
2023-08-25 19:06:17,491 - werkzeug - INFO - 127.0.0.1 - - [25/Aug/2023 19:06:17] "GET /static/js/352.863805ec.chunk.js HTTP/1.1" 200 -
2023-08-25 19:06:18,722 - werkzeug - INFO - 127.0.0.1 - - [25/Aug/2023 19:06:18] "GET /api/a098ce8a42bd11ee924dc87f5401e876/groups/0 HTTP/1.1" 200 -
2023-08-25 19:06:23,252 - flaskUI.restful - DEBUG - [{'success': {'/config/linkbutton': {'lastlinkbuttonpushed': 1692986783}}}]
2023-08-25 19:06:23,254 - configManager.configHandler - DEBUG - Dump config file /opt/hue-emulator/config/config.yaml
2023-08-25 19:06:23,254 - werkzeug - INFO - 127.0.0.1 - - [25/Aug/2023 19:06:23] "PUT /api/a098ce8a42bd11ee924dc87f5401e876/config HTTP/1.1" 200 -
2023-08-25 19:06:23,723 - werkzeug - INFO - 127.0.0.1 - - [25/Aug/2023 19:06:23] "GET /api/a098ce8a42bd11ee924dc87f5401e876/groups/0 HTTP/1.1" 200 -
2023-08-25 19:06:24,930 - werkzeug - INFO - **192.168.1.195** - - [25/Aug/2023 19:06:24] "GET /api/config HTTP/1.1" 200 -
2023-08-25 19:06:26,940 - flaskUI.restful - DEBUG - [{'success': {'/config/linkbutton': {'lastlinkbuttonpushed': 1692986786}}}]
2023-08-25 19:06:26,942 - configManager.configHandler - DEBUG - Dump config file /opt/hue-emulator/config/config.yaml
2023-08-25 19:06:26,942 - werkzeug - INFO - 127.0.0.1 - - [25/Aug/2023 19:06:26] "PUT /api/a098ce8a42bd11ee924dc87f5401e876/config HTTP/1.1" 200 -
2023-08-25 19:06:28,723 - werkzeug - INFO - 127.0.0.1 - - [25/Aug/2023 19:06:28] "GET /api/a098ce8a42bd11ee924dc87f5401e876/groups/0 HTTP/1.1" 200

Wireshark trace

No. Time Source Destination Protocol Length Info

192.168.1.50 - host with diyhue 192.168.1.195 - Mobile with Hue App Android

Port 80


1576    2023-08-25 20:12:09,925406252   192.168.1.195   192.168.1.50    HTTP    169 GET /api/config HTTP/1.1 
1577    2023-08-25 20:12:09,925441107   192.168.1.50    192.168.1.195   TCP 66  80 → 49022 [ACK] Seq=1 Ack=104 Win=65152 Len=0 TSval=3751392443 TSecr=608122
1578    2023-08-25 20:12:09,926141765   192.168.1.50    192.168.1.195   TCP 83  80 → 49022 [PSH, ACK] Seq=1 Ack=104 Win=65152 Len=17 TSval=3751392444 TSecr=608122 [TCP segment of a reassembled PDU]
1579    2023-08-25 20:12:09,929624984   192.168.1.195   192.168.1.50    TCP 66  49022 → 80 [ACK] Seq=104 Ack=18 Win=88064 Len=0 TSval=608123 TSecr=3751392444
1580    2023-08-25 20:12:09,929637267   192.168.1.50    192.168.1.195   HTTP/JSON   481 HTTP/1.1 200 OK , JavaScript Object Notation (application/json)
1581    2023-08-25 20:12:09,930569707   192.168.1.195   192.168.1.50    TCP 66  49022 → 80 [ACK] Seq=104 Ack=433 Win=89088 Len=0 TSval=608123 TSecr=3751392448
1582    2023-08-25 20:12:09,932222431   192.168.1.195   192.168.1.50    TCP 66  49022 → 80 [FIN, ACK] Seq=104 Ack=433 Win=89088 Len=0 TSval=608123 TSecr=3751392448
1583    2023-08-25 20:12:09,932253098   192.168.1.50    192.168.1.195   TCP 66  80 → 49022 [FIN, ACK] Seq=433 Ack=105 Win=65152 Len=0 TSval=3751392450 TSecr=608123
1584    2023-08-25 20:12:09,933907465   192.168.1.195   192.168.1.50    TCP 66  49022 → 80 [ACK] Seq=105 Ack=434 Win=89088 Len=0 TSval=608123 TSecr=3751392450

Now on port 443

1585    2023-08-25 20:12:09,945716272   192.168.1.195   192.168.1.50    TCP 74  44362 → 443 [SYN] Seq=0 Win=65535 Len=0 MSS=1460 SACK_PERM=1 TSval=608125 TSecr=0 WS=512
1586    2023-08-25 20:12:09,945744695   192.168.1.50    192.168.1.195   TCP 74  443 → 44362 [SYN, ACK] Seq=0 Ack=1 Win=65160 Len=0 MSS=1460 SACK_PERM=1 TSval=3751392464 TSecr=608125 WS=128
1587    2023-08-25 20:12:09,947794861   192.168.1.195   192.168.1.50    TCP 66  44362 → 443 [ACK] Seq=1 Ack=1 Win=88064 Len=0 TSval=608125 TSecr=3751392464
1588    2023-08-25 20:12:09,957674938   192.168.1.195   192.168.1.50    TLSv1.3 317 Client Hello
1589    2023-08-25 20:12:09,957712928   192.168.1.50    192.168.1.195   TCP 66  443 → 44362 [ACK] Seq=1 Ack=252 Win=65024 Len=0 TSval=3751392476 TSecr=608126
1590    2023-08-25 20:12:09,958073992   192.168.1.50    192.168.1.195   TLSv1.3 165 Hello Retry Request, Change Cipher Spec
1591    2023-08-25 20:12:09,960819706   192.168.1.195   192.168.1.50    TCP 66  44362 → 443 [ACK] Seq=252 Ack=100 Win=88064 Len=0 TSval=608126 TSecr=3751392476
1592    2023-08-25 20:12:09,992239377   192.168.1.195   192.168.1.50    TLSv1.3 356 Change Cipher Spec, Client Hello
1593    2023-08-25 20:12:09,992842973   192.168.1.50    192.168.1.195   TLSv1.3 1015    Server Hello, Application Data, Application Data, Application Data, Application Data
1594    2023-08-25 20:12:10,010538705   192.168.1.195   192.168.1.50    TCP 66  44362 → 443 [FIN, ACK] Seq=542 Ack=1049 Win=89600 Len=0 TSval=608131 TSecr=3751392511
1595    2023-08-25 20:12:10,010773833   192.168.1.50    192.168.1.195   TCP 66  443 → 44362 [FIN, ACK] Seq=1049 Ack=543 Win=64768 Len=0 TSval=3751392529 TSecr=608131
1596    2023-08-25 20:12:10,014303910   192.168.1.195   192.168.1.50    TCP 66  44362 → 443 [ACK] Seq=543 Ack=1050 Win=89600 Len=0 TSval=608131 TSecr=3751392529
#837 

No paring happened with Hue App Android.


Paring with All 4Hue App works.


2023-08-25 19:22:57,083 - flaskUI.restful - DEBUG - [{'success': {'/config/linkbutton': {'lastlinkbuttonpushed': 1692987777}}}]
2023-08-25 19:22:57,086 - configManager.configHandler - DEBUG - Dump config file /opt/hue-emulator/config/config.yaml
2023-08-25 19:22:57,086 - werkzeug - INFO - 127.0.0.1 - - [25/Aug/2023 19:22:57] "PUT /api/a098ce8a42bd11ee924dc87f5401e876/config HTTP/1.1" 200 -
2023-08-25 19:22:59,393 - flaskUI.restful - DEBUG - {'devicetype': 'all 4 hue#H8324', 'generateclientkey': True}
2023-08-25 19:22:59,393 - flaskUI.restful - DEBUG - [{'success': {'username': '6b80c862437411ee8500c87f5401e876', 'clientkey': 'A909269D37EB4FF3B5AAF26CA56D4DBA'}}]
2023-08-25 19:22:59,395 - configManager.configHandler - DEBUG - Dump config file /opt/hue-emulator/config/config.yaml
2023-08-25 19:22:59,397 - configManager.configHandler - DEBUG - Dump config file /opt/hue-emulator/config/lights.yaml
2023-08-25 19:22:59,397 - configManager.configHandler - DEBUG - Dump config file /opt/hue-emulator/config/groups.yaml
2023-08-25 19:22:59,397 - configManager.configHandler - DEBUG - Dump config file /opt/hue-emulator/config/scenes.yaml
2023-08-25 19:22:59,397 - configManager.configHandler - DEBUG - Dump config file /opt/hue-emulator/config/rules.yaml
2023-08-25 19:22:59,397 - configManager.configHandler - DEBUG - Dump config file /opt/hue-emulator/config/resourcelinks.yaml
2023-08-25 19:22:59,397 - configManager.configHandler - DEBUG - Dump config file /opt/hue-emulator/config/schedules.yaml
2023-08-25 19:22:59,398 - configManager.configHandler - DEBUG - Dump config file /opt/hue-emulator/config/sensors.yaml
2023-08-25 19:22:59,398 - configManager.configHandler - DEBUG - Dump config file /opt/hue-emulator/config/behavior_instance.yaml
2023-08-25 19:22:59,398 - werkzeug - INFO - 192.168.1.195 - - [25/Aug/2023 19:22:59] "POST /api/ HTTP/1.1" 200 -
2023-08-25 19:22:59,428 - werkzeug - INFO - 192.168.1.195 - - [25/Aug/2023 19:22:59] "GET /api/6b80c862437411ee8500c87f5401e876 HTTP/1.1" 200 -
2023-08-25 19:22:59,459 - werkzeug - INFO - 192.168.1.195 - - [25/Aug/2023 19:22:59] "GET /clip/v2/resource HTTP/1.1" 200 -
2023-08-25 19:23:01,341 - services.stateFetch - INFO - start lights sync

No. Time Source Destination Protocol Length Info

Port 80


350 2023-08-25 20:22:59,392655269   192.168.1.195   192.168.1.50    HTTP    363 POST /api/ HTTP/1.1  (application/x-www-form-urlencoded)
351 2023-08-25 20:22:59,398567665   192.168.1.50    192.168.1.195   TCP 83  80 → 49836 [PSH, ACK] Seq=1 Ack=298 Win=505 Len=17 TSval=3752041916 TSecr=630678 [TCP segment of a reassembled PDU]
352 2023-08-25 20:22:59,402930369   192.168.1.195   192.168.1.50    TCP 66  49836 → 80 [ACK] Seq=298 Ack=18 Win=176 Len=0 TSval=630680 TSecr=3752041916
353 2023-08-25 20:22:59,402939426   192.168.1.50    192.168.1.195   HTTP/JSON   341 HTTP/1.1 200 OK , JavaScript Object Notation (application/json)
354 2023-08-25 20:22:59,404831427   192.168.1.195   192.168.1.50    TCP 66  49836 → 80 [ACK] Seq=298 Ack=293 Win=178 Len=0 TSval=630681 TSecr=3752041921
355 2023-08-25 20:22:59,427936553   192.168.1.195   192.168.1.50    HTTP    261 GET /api/6b80c862437411ee8500c87f5401e876 HTTP/1.1 
356 2023-08-25 20:22:59,428557862   192.168.1.50    192.168.1.195   TCP 83  80 → 49836 [PSH, ACK] Seq=293 Ack=493 Win=504 Len=17 TSval=3752041946 TSecr=630683 [TCP segment of a reassembled PDU]
357 2023-08-25 20:22:59,428600231   192.168.1.50    192.168.1.195   TCP 1514    80 → 49836 [ACK] Seq=310 Ack=493 Win=504 Len=1448 TSval=3752041947 TSecr=630683 [TCP segment of a reassembled PDU]
358 2023-08-25 20:22:59,428601914   192.168.1.50    192.168.1.195   TCP 1514    80 → 49836 [PSH, ACK] Seq=1758 Ack=493 Win=504 Len=1448 TSval=3752041947 TSecr=630683 [TCP segment of a reassembled PDU]
359 2023-08-25 20:22:59,431524439   192.168.1.195   192.168.1.50    TCP 66  49836 → 80 [ACK] Seq=493 Ack=1758 Win=184 Len=0 TSval=630683 TSecr=3752041946
360 2023-08-25 20:22:59,431532575   192.168.1.50    192.168.1.195   HTTP/JSON   897 HTTP/1.1 200 OK , JavaScript Object Notation (application/json)
361 2023-08-25 20:22:59,433865058   192.168.1.195   192.168.1.50    TCP 66  49836 → 80 [ACK] Seq=493 Ack=4037 Win=195 Len=0 TSval=630684 TSecr=3752041947

Port 443


362 2023-08-25 20:22:59,444174410   192.168.1.195   192.168.1.50    TCP 74  45602 → 443 [SYN] Seq=0 Win=65535 Len=0 MSS=1460 SACK_PERM=1 TSval=630685 TSecr=0 WS=512
363 2023-08-25 20:22:59,444203905   192.168.1.50    192.168.1.195   TCP 74  443 → 45602 [SYN, ACK] Seq=0 Ack=1 Win=65160 Len=0 MSS=1460 SACK_PERM=1 TSval=3752041962 TSecr=630685 WS=128
364 2023-08-25 20:22:59,447711793   192.168.1.195   192.168.1.50    TCP 66  45602 → 443 [ACK] Seq=1 Ack=1 Win=88064 Len=0 TSval=630685 TSecr=3752041962
365 2023-08-25 20:22:59,448414394   192.168.1.195   192.168.1.50    TLSv1.3 322 Client Hello
366 2023-08-25 20:22:59,448419123   192.168.1.50    192.168.1.195   TCP 66  443 → 45602 [ACK] Seq=1 Ack=257 Win=65024 Len=0 TSval=3752041966 TSecr=630685
367 2023-08-25 20:22:59,448549767   192.168.1.50    192.168.1.195   TLSv1.3 165 Hello Retry Request, Change Cipher Spec
368 2023-08-25 20:22:59,449979155   192.168.1.195   192.168.1.50    TCP 66  45602 → 443 [ACK] Seq=257 Ack=100 Win=88064 Len=0 TSval=630685 TSecr=3752041966
369 2023-08-25 20:22:59,450634348   192.168.1.195   192.168.1.50    TLSv1.3 589 Change Cipher Spec, Client Hello
370 2023-08-25 20:22:59,451066033   192.168.1.50    192.168.1.195   TLSv1.3 1015    Server Hello, Application Data, Application Data, Application Data, Application Data
371 2023-08-25 20:22:59,456387816   192.168.1.195   192.168.1.50    TLSv1.3 140 Application Data
372 2023-08-25 20:22:59,456506448   192.168.1.50    192.168.1.195   TLSv1.3 321 Application Data
373 2023-08-25 20:22:59,458420510   192.168.1.195   192.168.1.50    TLSv1.3 318 Application Data
374 2023-08-25 20:22:59,458424027   192.168.1.50    192.168.1.195   TLSv1.3 321 Application Data
375 2023-08-25 20:22:59,459068780   192.168.1.50    192.168.1.195   TLSv1.3 1514    Application Data, Application Data
376 2023-08-25 20:22:59,459070544   192.168.1.50    192.168.1.195   TCP 1514    443 → 45602 [ACK] Seq=3007 Ack=1106 Win=64384 Len=1448 TSval=3752041977 TSecr=630686 [TCP segment of a reassembled PDU]
377 2023-08-25 20:22:59,459071045   192.168.1.50    192.168.1.195   TCP 1514    443 → 45602 [ACK] Seq=4455 Ack=1106 Win=64384 Len=1448 TSval=3752041977 TSecr=630686 [TCP segment of a reassembled PDU]
378 2023-08-25 20:22:59,459071506   192.168.1.50    192.168.1.195   TCP 1514    443 → 45602 [ACK] Seq=5903 Ack=1106 Win=64384 Len=1448 TSval=3752041977 TSecr=630686 [TCP segment of a reassembled PDU]
379 2023-08-25 20:22:59,459071896   192.168.1.50    192.168.1.195   TCP 1514    443 → 45602 [PSH, ACK] Seq=7351 Ack=1106 Win=64384 Len=1448 TSval=3752041977 TSecr=630686 [TCP segment of a reassembled PDU]
380 2023-08-25 20:22:59,460291793   192.168.1.195   192.168.1.50    TCP 66  45602 → 443 [ACK] Seq=1106 Ack=3007 Win=96256 Len=0 TSval=630686 TSecr=3752041976
381 2023-08-25 20:22:59,460295270   192.168.1.50    192.168.1.195   TLSv1.3 512 Application Data
382 2023-08-25 20:22:59,460425373   192.168.1.195   192.168.1.50    TCP 66  45602 → 443 [ACK] Seq=1106 Ack=5903 Win=102400 Len=0 TSval=630686 TSecr=3752041977
383 2023-08-25 20:22:59,460552951   192.168.1.195   192.168.1.50    TCP 66  45602 → 443 [ACK] Seq=1106 Ack=8799 Win=108032 Len=0 TSval=630686 TSecr=3752041977
388 2023-08-25 20:22:59,494041567   192.168.1.195   192.168.1.50    TCP 66  45602 → 443 [ACK] Seq=1106 Ack=9245 Win=111104 Len=0 TSval=630690 TSecr=3752041978

For me it looks like everything is configured correctly. Any Idea?

Write commented 10 months ago

Hi, I have the same issue with docker diyhue/core:916. I cannot connect with Hue App Android Version 4.49.0 (tried some older versions with same result). Hue Essentials work fine. All 4 Hue works fine. (I used original Hue Bridge connection type.)

Website is availavle with: https://localhost/.

Can you try if you can pair Hue Bridge with v4.31.1 of Hue App ?

MarkusH1975 commented 10 months ago

Can you try if you can pair Hue Bridge with v4.31.1 of Hue App ?

Why has this apkcombo App > 200 MB? App from Play Store has just 85 MB.

Anyway, since I have a Test-Phone, I installed it. And, yes it was paring, but the debug output shows an Exception Error in diyhue.



2023-08-25 20:42:32,438 - werkzeug - INFO - 192.168.1.195 - - [25/Aug/2023 20:42:32] "POST /api HTTP/1.1" 200 -
[2023-08-25 20:42:32,558] **ERROR in app: Exception on** /api/8874fa46437f11ee92bfc87f5401e876/config [PUT]
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)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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/restful.py", line 274, in put
    bridgeConfig[resource][key].update(value)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^
KeyError: 'swupdate2'
julek-fr commented 10 months ago

I have the same issue also. I have the following error in the debug logs:

2023-09-13 21:17:57,019 - werkzeug - INFO - 192.168.0.3 - - [13/Sep/2023 21:17:57] "GET /eventstream/clip/v2 HTTP/1.1" 200 - [2023-09-13 21:17:57,025] ERROR in app: Exception on /api/3ed2e12e526a11eeb2795254001c12f7/config [PUT] 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/restful.py", line 274, in put bridgeConfig[resource][key].update(value) KeyError: 'swupdate2'

ummetcivi commented 10 months ago

I have the same issue with iOS app. I can pair with Hue essentials but not with original Hue App.

Sirgrant618 commented 10 months ago

Throwing my hat in the ring. same issue here. Running on docker. CN number matches bridge ID. Hue app simply will not connect. Reinstalling does not work.

2ZZ commented 10 months ago

+1 I'm also having the same issue with it in Docker and as a HA add-on

jamesremuscat commented 9 months ago

Encountering the same issue, and I've spotted a difference in the SSL certificates between the genuine Hue hub and diyHue. I don't know if it's always been there, or if it's changed recently:

Genuine hub:

* Server certificate:
*  subject: C=NL; O=Philips Hue; CN=ecb5fafffea85681
*  start date: Jan  1 00:00:00 2017 GMT
*  expire date: Jan 19 03:14:07 2038 GMT
*  issuer: C=NL; O=Philips Hue; CN=root-bridge
*  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.

diyHue:

* Server certificate:
*  subject: C=NL; O=Philips Hue; CN=0242c0fffea80251
*  start date: Sep 25 16:18:21 2023 GMT
*  expire date: Sep 22 16:18:21 2033 GMT
*  issuer: C=NL; O=Philips Hue; CN=0242c0fffea80251
*  SSL certificate verify result: self-signed certificate (18), continuing anyway.

Note the issuer field on both: the original Hue cert is from root-bridge rather than being self-signed.

EDIT: adb logcat on Android phone suggests this could well be the issue:

09-25 17:58:45.683 15699 15765 I flutter : Security challenge for bridge BridgeId(xxxxxxx51):
09-25 17:58:45.683 15699 15765 I flutter : Certificate verification failed: CertificateValidationFailureReason.unknownRootCertificate
09-25 17:58:45.683 15699 15765 I flutter : Description: null
09-25 17:58:45.683 15699 15765 I flutter : Rejecting security challenge.
09-25 17:58:45.683 15699 15765 I flutter : All futures completed with errors. Error list:
09-25 17:58:45.683 15699 15765 I flutter : (BridgeRequestFailedException(Bridge did not successfully respond to https://192.168.2.81/api: HandshakeException: Handshake error in client (OS Error: 
09-25 17:58:45.683 15699 15765 I flutter :      CERTIFICATE_VERIFY_FAILED: unable to get local issuer certificate(handshake.cc:393)))
09-25 17:58:45.683 15699 15765 I flutter : #0      makeBridgeRequest (package:bridge_control/src/bridge_lib.dart:272)
09-25 17:58:45.683 15699 15765 I flutter : <asynchronous suspension>
09-25 17:58:45.683 15699 15765 I flutter : #1      BridgeLib.makeBridgeClipV1Request (package:bridge_control/src/bridge_lib.dart:83)
09-25 17:58:45.683 15699 15765 I flutter : <asynchronous suspension>
09-25 17:58:45.683 15699 15765 I flutter : #2      BridgeClient.getAuthorizationToken (package:bridge_control/src/bridge_client.dart:297)
09-25 17:58:45.683 15699 15765 I flutter : <asynchronous suspension>
09-25 17:58:45.683 15699 15765 I flutter : #3      BridgeClient.authorize (package:bridge_control/src/bridge_client.dart:267)
09-25 17:58:45.683 15699 15765 I flutter : <asynchronous suspension>
09-25 17:58:45.683 15699 15765 I flutter : #4      anyValue.<anonymous closure> (package:utils/src/futures.dart:22)
09-25 17:58:45.683 15699 15765 I flutter : <asynchronous suspension>
09-25 17:58:45.683 15699 15765 I flutter : 
09-25 17:58:45.683 15699 15765 I flutter : 
09-25 17:58:45.683 15699 15765 I flutter : ), #0      makeBridgeRequest (package:bridge_control/src/bridge_lib.dart:272)
09-25 17:58:45.683 15699 15765 I flutter : <asynchronous suspension>
09-25 17:58:45.683 15699 15765 I flutter : #1      BridgeLib.makeBridgeClipV1Request (package:bridge_control/src/bridge_lib.dar
mattisz commented 9 months ago

I managed to get a new docker install connected to the official Hue app today after a few hours of trial and error. The problem is I was moving somewhat quickly and didn't unit test so it could be some combination of the following.

  1. I messed with the cert a little bit to match the cert on my official hue bridge. Specifically the validity period and enforcing the keyid in the authorityKeyIdentifier. The changes to the cert generation scripts was merged today so pull down a new version to see if that solves your problems

  2. I'm running diyHue in docker on a VM. I set the interface MAC to an address that falls in the Phillips lighting block range. Not sure if this matters but I have 2 official bridges and they both fall in this range so it would be easy for them to write validation code based on this.

  3. Delete the Hue app from my phone to start fresh with the new cert.

  4. Once I got the pairing process working, I was being forced to update the bridge before I could add lights or anything. I changed the swversion in the config to 1960062030 and the apiversion to 1.60.0 as those were the values from my official bridge. Once I restarted diyHue and my hue app, I was able to use the app as expected. I changed the swversion and apiversion back to the default values after I got rid of the app block and have not had any issues since.

Hopefully this helps some of you out there.

ummetcivi commented 9 months ago

I can confirm that @mattisz's approach is working! I didn't try to add bulbs etc but I'll update once I do it.

Thanks @mattisz !

Flashlab2 commented 9 months ago

I can also confirm @mattisz method works. And that you don't need to change the MAC interface address to match Phillips' range. So step 2 is optional.

saschabrockel commented 9 months ago

Is the update live now? I would like to test it.

2ZZ commented 9 months ago

I followed @mattisz's steps but failed on step 4. After the mandatory update message I changed to the versions numbers above, restarted DiyHue and the phone app. Then the app asks me for all my details again, I go through the process and eventually hit the swupdate2 error

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)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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/restful.py", line 275, in put
    bridgeConfig[resource][key].update(value)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^
KeyError: 'swupdate2'

I added an empty yaml dict to config.yaml which stopped this error on the next attempt.

swupdate2: {}
...
2023-10-18 20:53:50,108 - flaskUI.restful - DEBUG - [{'success': {'/config/swupdate2': {'install': False, 'autoinstall': {'on': True}}}}]

However after pressing the sync button I see the "Connected to your Hue Bridge" success message, but when I press continue it goes to a "No Hue Bridge found" error.

I also tried the whole process with the versions pre-updated but this didn't help.

mhajder commented 8 months ago

@2ZZ I have exactly the same problem, but I managed to work around it. In the options, I set swversion and apiversion to the values in the above post and when the HUE mobile application asks me to log in, I click SKIP in the upper right corner. It seems that HUE somehow detects that this gateway is not authentic. Even after adding the gateway to my mobile application, I still receive this error when trying to log in with my HUE account.

Fisico commented 8 months ago

@mhajder @2ZZ In my config i have Software version: 1960149090 and API Version: 1.56.0 App works fine now.

Always get the latest Hue version from here: https://www.philips-hue.com/en-gb/support/release-notes/bridge

Philips Hue UK
Philips Hue Support - Release Notes Hue Bridge | Philips Hue UK
Bridge release notes
2ZZ commented 8 months ago

That didn't work for me unfortunately. I still get the "No Hue Bridge Found" message after pressing the link button

rudironsonijr commented 5 months ago

That didn't work for me unfortunately. I still get the "No Hue Bridge Found" message after pressing the link button

Same here.

Any help?