diyhue / diyHue

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

No longer visible in Home assistant #646

Closed jimmyeao closed 2 years ago

jimmyeao commented 3 years ago

Describe the issue

Unable to add DIYhue to Homeassistant

Steps you tried

How we can help see https://github.com/home-assistant/core/issues/51611 DIYHue is not correctly emulating huehubs

Logs

N/A

Docker Info (please complete the following information):

Checklist

Additional context

stale[bot] commented 3 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.

Mevel commented 3 years ago

any sucess on this topic?

jimmyeao commented 3 years ago

Nothing yet

stale[bot] commented 3 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.

mariusmotea commented 3 years ago

Please try with last beta release. I was able to pull last homeassistant docker image and pair it to diyhue home instance.

jimmyeao commented 3 years ago

Not working for me, the latest beta release a) doesn't install fully via install.sh script, and b) does not pair with either Hue App, Hue Essentials App or Home assistant. to get the beta running, I have to install via the script, then download and extract the beta branch and copy the files across.

2021-07-13 09:49:51,448 - services.ssdp - DEBUG - Sending M-Search response to 192.168.0.93
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
192.168.0.118 - - [13/Jul/2021 09:49:51] "POST /api/ HTTP/1.1" 200 -
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
192.168.0.118 - - [13/Jul/2021 09:49:52] "POST /api/ HTTP/1.1" 200 -
[{'success': {'/config/linkbutton': {'lastlinkbuttonpushed': 1626166136}}}]
2021-07-13 09:49:53,065 - configManager.configHandler - DEBUG - Dump config file /opt/hue-emulator/config/config.yaml
192.168.0.77 - - [13/Jul/2021 09:49:53] "PUT /api/e1ce65aee3b511ebb2dab827ebb9482b/config HTTP/1.1" 200 -
192.168.0.44 - - [13/Jul/2021 09:49:53] "GET /api/e59da684ca8f11eba109b827ebb9482b/sensors HTTP/1.1" 200 -
192.168.0.44 - - [13/Jul/2021 09:49:53] "GET /api/e59da684ca8f11eba109b827ebb9482b/rules HTTP/1.1" 200 -
192.168.0.44 - - [13/Jul/2021 09:49:53] "GET /api/e59da684ca8f11eba109b827ebb9482b/groups HTTP/1.1" 200 -
192.168.0.44 - - [13/Jul/2021 09:49:53] "GET /api/e59da684ca8f11eba109b827ebb9482b/lights HTTP/1.1" 200 -
192.168.0.77 - - [13/Jul/2021 09:49:53] "GET /api/e1ce65aee3b511ebb2dab827ebb9482b/groups/0 HTTP/1.1" 200 -
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
192.168.0.118 - - [13/Jul/2021 09:49:53] "POST /api/ HTTP/1.1" 200 -
2021-07-13 09:49:54,405 - services.ssdp - DEBUG - Sending M-Search response to 192.168.0.92
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
192.168.0.118 - - [13/Jul/2021 09:49:54] "POST /api/ HTTP/1.1" 200 -
2021-07-13 09:49:55,708 - services.ssdp - DEBUG - Sending M-Search response to 192.168.0.92
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
192.168.0.118 - - [13/Jul/2021 09:49:55] "POST /api/ HTTP/1.1" 200 -
2021-07-13 09:49:55,988 - services.stateFetch - INFO - start lights sync
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
192.168.0.118 - - [13/Jul/2021 09:49:56] "POST /api/ HTTP/1.1" 200 -
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
192.168.0.118 - - [13/Jul/2021 09:49:58] "POST /api/ HTTP/1.1" 200 -
mariusmotea commented 3 years ago

Ok, let me fix today the installation via install.sh script and try to pair Hue Essentials with a fresh install. You did not try the docker image?

jimmyeao commented 3 years ago

No, I can try it if you like?

jimmyeao commented 3 years ago

Tried the docker, hue essentials occasionally crashes when trying to add the bridge (right after I click link app) or just sits there waiting at the "push link button on the bridge" screen, and HomeAssistant reports "Failed to register, please try again" The Hue app finds the bridge but will not pair (No error, just sits on the "press the button" screen)

Docker image was installed with docker run -d --name diyHue --restart=always --network=host -e MAC=b8:27:eb:b9:48:2b -v /mnt/hue-emulator/export:/opt/hue-emulator/export diyhue/core:beta

mariusmotea commented 3 years ago

any errors in the log?

BTW the config path is now different:

docker run -d --name diyHue --restart=always --network=host -e MAC=b8:27:eb:b9:48:2b -v /mnt/hue-emulator:/opt/hue-emulator/config diyhue/core:beta

jimmyeao commented 3 years ago

Nothing except repeating lines:

{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
[{'success': {'/config/linkbutton': {'lastlinkbuttonpushed': 1626198859}}}]
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
[{'success': {'/config/linkbutton': {'lastlinkbuttonpushed': 1626198872}}}]
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
{'devicetype': 'Hue Essentials#iPhone', 'generateclientkey': True}
jimmyeao commented 3 years ago

one thing I just noticed... the Docker logs are an hour behind my system clock, could this cause an issue?

192.168.0.44 - - [13/Jul/2021 18:08:48] "GET /api/e59da684ca8f11eba109b827ebb9482b/sensors HTTP/1.1" 200 -
192.168.0.44 - - [13/Jul/2021 18:08:48] "GET /api/e59da684ca8f11eba109b827ebb9482b/rules HTTP/1.1" 200 -
root@huepihub:/home/pi# date
Tue 13 Jul 19:08:52 BST 2021
root@huepihub:/home/pi#
mariusmotea commented 3 years ago

No, Hue app set automatically the timezone after first pair

What output you have from following command:

curl https://127.0.0.1/api/nouser/config -v -k

Is the certificate CN field based on your mac address from the interface where the connections are coming?

jimmyeao commented 3 years ago

Looks to be based on my MAC with dome extra "fff" in the middle

* Expire in 0 ms for 6 (transfer 0x19838b0)
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x19838b0)
* Connected to 127.0.0.1 (127.0.0.1) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* 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 to a protocol
* Server certificate:
*  subject: C=NL; O=Philips Hue; CN=b827ebfffeb9482b
*  start date: Jul 13 17:54:53 2021 GMT
*  expire date: Jul 11 17:54:53 2031 GMT
*  issuer: C=NL; O=Philips Hue; CN=b827ebfffeb9482b
*  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
> GET /api/nouser/config HTTP/1.1
> Host: 127.0.0.1
> User-Agent: curl/7.64.0
> 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: 1473
< Server: Werkzeug/1.0.1 Python/3.7.3
< Date: Wed, 14 Jul 2021 11:19:38 GMT
<
{"backup": {"errorcode": 0, "status": "idle"}, "datastoreversion": "103", "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": "6d4a2332e40311eb84d7b827ebb9482b", "Remote API enabled": false, "apiversion": "1.44.0", "bridgeid": "B827EBFFFEB9482B", "ipaddress": "192.168.0.98", "netmask": "255.255.255.0", "gateway": "192.168.0.1", "mac": "b8:27:eb:b9:48:2b", "name": "DiyHue Bridge", "swversion": "1945091050", "timezone": "Europe/London", "UTC": "2021-07-14T11:19:38", "localtime": "2021-07-14T11:19:38", "whitelist": {"719095d4e40311ebbfb7b827ebb9482b": {"create date": "2021-07-13T17:54:53", "last use date": "2021-07-14T08:26:06", "name": "WebUi"}}}
* Connection #0 to host 127.0.0.1 left intact
jimmyeao commented 3 years ago

Ok, 1 step forwards, flatten the Pi and re installed the docker, I can now pair with Hue Essentials but not Homeassistant. Im running homeassistant on https if that makes any difference?

mariusmotea commented 3 years ago

It must work. I ping you on Slack for a more interactive debugging session. Reply when you have some time.

SerhiiAksiutin commented 3 years ago

Was able to connect the beta to Hue 4.1 app but it asks for a mandatory bridge update :(

IMG_1338

Hue Sync app can't find the bridge

mariusmotea commented 3 years ago

Change swversion in the webpage Bridge section. You have there an url to see what is the last swversion available.

SerhiiAksiutin commented 3 years ago

What webpage / URL? I updated swversion in the config.json from 1944193080 to 1945163030 but this didn't help

mariusmotea commented 3 years ago

This is only in beta branch. Use docker image with beta tag.

SerhiiAksiutin commented 3 years ago

I am in beta but not docker

mariusmotea commented 3 years ago

Be aware that beta branch use different folder for config files. It is /opt/hue-emulator/config instead of /opt/hue-emulator/export . Also the files are in yaml format, not json.

SerhiiAksiutin commented 3 years ago

Docker failed on my Pi 3:


Unable to find image 'diyhue/core:beta' locally
beta: Pulling from diyhue/core
321095abe1cf: Pull complete 
d588e39dc058: Pull complete 
2efc8772e47c: Pull complete 
18f247804446: Pull complete 
f240d789c446: Pull complete 
3c9002578b9d: Pull complete 
eb737417e986: Pull complete 
469732527418: Pull complete 
ef06c3f9b520: Pull complete 
e6a921ab6fd2: Pull complete 
27e5cedc33ce: Pull complete 
83ab00730d8f: Pull complete 
fca401fae141: Pull complete 
1f2f160b28be: Pull complete 
53884dfe4570: Pull complete 
Digest: sha256:3911c49664b3fef84b19e9c02930895b808513356ac08f9732535401b8614687
Status: Downloaded newer image for diyhue/core:beta
e1a35dc778a1782d7ec3659c3e255b6c845f38208eed9b51e20a648cb18423a3
docker: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:338: getting the final child's pid from pipe caused: read init-p: connection reset by peer: unknown.```
mariusmotea commented 3 years ago

try diyhue/core:armv7-beta instead of diyhue/core:beta

Better join Slack channel to not spam this thread with the wrong issue.

SerhiiAksiutin commented 3 years ago

try diyhue/core:armv7-beta instead of diyhue/core:beta

No luck with armv7-beta and Pi 3. Sorry for spam. Wanted to conclude the wrong issue:

Unable to find image 'diyhue/core:armv7-beta' locally
armv7-beta: Pulling from diyhue/core
321095abe1cf: Already exists 
d588e39dc058: Already exists 
2efc8772e47c: Already exists 
18f247804446: Already exists 
f240d789c446: Already exists 
3c9002578b9d: Already exists 
eb737417e986: Already exists 
469732527418: Already exists 
ef06c3f9b520: Already exists 
6d2422924df3: Pull complete 
ad8d5624b7b1: Pull complete 
b85a86aa663a: Pull complete 
75f9fdf6d795: Pull complete 
316bb3ce9ef1: Pull complete 
74acef828f71: Pull complete 
Digest: sha256:5f5cfcf60ec5a0a6328ac0ecc89b054a3c8d44e518182407e85c00a6a8fa735b
Status: Downloaded newer image for diyhue/core:armv7-beta
docker: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:338: getting the final child's pid from pipe caused: read init-p: connection reset by peer: unknown.
ERRO[0007] error waiting for container: context canceled

Heading to the slack

jimmyeao commented 3 years ago

try docker image prune -a to remove the existing image

Mr-Groch commented 3 years ago

Be aware that beta branch use different folder for config files. It is /opt/hue-emulator/config instead of /opt/hue-emulator/export . Also the files are in yaml format, not json.

Is there any converter or doc how to convert old json config with all my rooms, zones, scenes, etc to new one?

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.