diyhue / diyHue

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

discovery.diyhue.org autodiscovery not publishing #1030

Open alexejFroebel opened 3 months ago

alexejFroebel commented 3 months ago

Issue does not already exist?

No, I did not search

Select Environment

Docker

Home Assistant related?

No

Description

Hello, if I flip the switch for discovery in the bridge settings, I see that the config is saved correctly.

[ { "success": { "/config/name": "Philips hue" } }, { "success": { "/config/swversion": "1965053040" } }, { "success": { "/config/apiversion": "1.65.0" } }, { "success": { "/config/timezone": "Europe/Berlin" } }, { "success": { "/config/Remote API enabled": true } }, { "success": { "/config/discovery": true } } ]

If I visit the site: https://discovery.diyhue.org/ I receive an empty array. I can also see that my dns resolved this url when saving the config: remote.diyhue.org. So I assume the data gets pushed to the correct servers. However, if I reload the config page, the switch is turned off automatically.

Am I doing something wrong or is there a Problem with this Feature?

Errorlog:

No entries of intrest in logs

Steps to reproduce

  1. Go to settings
  2. Enable Discovery
  3. Save
  4. Goto https://discovery.diyhue.org/
  5. Empty Array as response
  6. Reload config page
  7. Switch is turned off

Please enter your operating system details here

System debug information: (Work in progress) Hue-Emulator Version: 2024-07-09 21:33:49.000000000 +0200 WebUI Version: 2024-07-23 23:45:45.496579972 +0200 Architecture: aarch64 OS: Linux Linux version: #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) Linux release: 6.6.31+rpt-rpi-v8 Hardware: %Hardware%

Upload debug tar

No entries of intrest in logs

What DiyHue version(branch) are you using?

master (latest)

hendriksen-mark commented 3 months ago

that discovery is not on after page reload is normal because discovery is not in the config api, i will include it in the next release. You can check if it is on if you go to ^bridge-ip^/api/^API_KEY^/config/discovery You can get a API_KEY by going to ^bridge-ip^/get-key If it is on it should return true if not it should return false.

mariusmotea commented 3 months ago

You need to restart diyhue after you enable discovery switch in settings because the discovery service is enable only at startup if enabled in config.

alexejFroebel commented 3 months ago

Okay I will check, thank you :)

alexejFroebel commented 3 months ago

So I now restartet with discovery enabled, i can see in the logs that Online Discovery is enabled. However, the webpage still returns an empty array: diyhue | 2024-07-24 14:01:46,989 - configManager.argumentHandler - INFO - Using Host 192.168.2.55:80 diyhue | 2024-07-24 14:01:46,998 - configManager.argumentHandler - INFO - Host MAC given as dca63269f8a6 diyhue | 2024-07-24 14:01:46,998 - configManager.argumentHandler - INFO - IP range for light discovery: 0-255 diyhue | 2024-07-24 14:01:46,999 - configManager.argumentHandler - INFO - Deconz IP given as 127.0.0.1 diyhue | 2024-07-24 14:01:46,999 - configManager.argumentHandler - INFO - Online Discovery/Remote API Enabled! diyhue | 2024-07-24 14:01:47,007 - configManager.argumentHandler - INFO - Using Host 192.168.2.55:80 diyhue | 2024-07-24 14:01:47,015 - configManager.argumentHandler - INFO - Host MAC given as dca63269f8a6 diyhue | 2024-07-24 14:01:47,016 - configManager.argumentHandler - INFO - IP range for light discovery: 0-255 diyhue | 2024-07-24 14:01:47,016 - configManager.argumentHandler - INFO - Deconz IP given as 127.0.0.1 diyhue | 2024-07-24 14:01:47,017 - configManager.argumentHandler - INFO - Online Discovery/Remote API Enabled! diyhue | 2024-07-24 14:01:47,023 - configManager.argumentHandler - INFO - Debug logging disabled! diyhue | 2024-07-24 14:01:47,059 - configManager.configHandler - INFO - Config loaded diyhue | 2024-07-24 14:01:47,568 - services.updateManager - INFO - no swversion number update from Philips diyhue | 2024-07-24 14:01:47,995 - services.updateManager - INFO - creation_time diyHue : 2024-07-09 19 diyhue | 2024-07-24 14:01:47,996 - services.updateManager - INFO - publish_time diyHue : 2024-07-09 19 diyhue | 2024-07-24 14:01:48,325 - services.updateManager - INFO - creation_time UI : 2024-06-09 18 diyhue | 2024-07-24 14:01:48,325 - services.updateManager - INFO - publish_time UI : 2024-07-13 00 diyhue | 2024-07-24 14:01:48,326 - services.updateManager - INFO - UI update on github diyhue | 2024-07-24 14:01:48,327 - services.homeAssistantWS - WARNING - Home Assistant Web Socket Client disconnected trying to (re)connect diyhue | 2024-07-24 14:01:48,331 - services.homeAssistantWS - INFO - Home Assistant WebSocket Connection Opened diyhue | 2024-07-24 14:01:48,333 - services.homeAssistantWS - INFO - Home Assistant Web Socket Authorisation required diyhue | 2024-07-24 14:01:48,333 - services.homeAssistantWS - INFO - Home Assistant Web Socket Client connected diyhue | 2024-07-24 14:01:48,335 - services.remoteDiscover - INFO - Starting discovery service diyhue | 2024-07-24 14:01:48,337 - services.homeAssistantWS - INFO - Home Assistant Web Socket Authorisation complete diyhue | 2024-07-24 14:01:48,339 - services.stateFetch - INFO - start lights sync diyhue | 2024-07-24 14:01:48,343 - services.stateFetch - WARNING - Wecker Licht Switch is unreachable: 'switch.weckerlichtswitch' diyhue | 2024-07-24 14:01:48,345 - services.ssdp - INFO - start ssdp broadcast diyhue | 2024-07-24 14:01:48,358 - services.mdns - INFO - listener started diyhue | 2024-07-24 14:01:48,361 - services.homeAssistantWS - INFO - Found switch.weckerlichtswitch diyhue | 2024-07-24 14:01:48,362 - services.ssdp - INFO - starting ssdp... diyhue | Serving Flask app 'HueEmulator3' (lazy loading) diyhue | Environment: production diyhue | WARNING: This is a development server. Do not use it in a production deployment. diyhue | Use a production WSGI server instead. diyhue | Debug mode: off diyhue | Serving Flask app 'HueEmulator3' (lazy loading) diyhue | Environment: production diyhue | WARNING: This is a development server. Do not use it in a production deployment. diyhue | Use a production WSGI server instead. diyhue | Debug mode: off diyhue | 2024-07-24 14:01:48,398 - werkzeug - WARNING - Running on all addresses. diyhue | WARNING: This is a development server. Do not use it in a production deployment. diyhue | 2024-07-24 14:01:48,399 - werkzeug - INFO - Running on http://192.168.2.55:80/ (Press CTRL+C to quit) diyhue | 2024-07-24 14:01:48,400 - werkzeug - WARNING - Running on all addresses. diyhue | WARNING: This is a development server. Do not use it in a production deployment. diyhue | 2024-07-24 14:01:48,402 - werkzeug - INFO - Running on https://192.168.2.55:443/ (Press CTRL+C to quit) diyhue | 2024-07-24 14:01:49,139 - werkzeug - INFO - 10.200.200.1 - - [24/Jul/2024 14:01:49] "GET /api/811c3738485f11efa9c2dca63269f8a6/config/swupdate2 HTTP/1.1" 200 - diyhue | 2024-07-24 14:01:49,144 - werkzeug - INFO - 10.200.200.1 - - [24/Jul/2024 14:01:49] "GET /api/811c3738485f11efa9c2dca63269f8a6/groups/0 HTTP/1.1" 200 - diyhue | 2024-07-24 14:01:54,096 - werkzeug - INFO - 10.200.200.1 - - [24/Jul/2024 14:01:54] "GET /api/811c3738485f11efa9c2dca63269f8a6/config/swupdate2 HTTP/1.1" 200 - diyhue | 2024-07-24 14:01:54,098 - werkzeug - INFO - 10.200.200.1 - - [24/Jul/2024 14:01:54] "GET /api/811c3738485f11efa9c2dca63269f8a6/groups/0 HTTP/1.1" 200 - diyhue | 2024-07-24 14:01:59,103 - werkzeug - INFO - 10.200.200.1 - - [24/Jul/2024 14:01:59] "GET /api/811c3738485f11efa9c2dca63269f8a6/config/swupdate2 HTTP/1.1" 200 - diyhue | 2024-07-24 14:01:59,108 - werkzeug - INFO - 10.200.200.1 - - [24/Jul/2024 14:01:59] "GET /api/811c3738485f11efa9c2dca63269f8a6/groups/0 HTTP/1.1" 200 - diyhue | 2024-07-24 14:02:00,348 - services.stateFetch - INFO - start lights sync diyhue | 2024-07-24 14:02:04,094 - werkzeug - INFO - 10.200.200.1 - - [24/Jul/2024 14:02:04] "GET /api/811c3738485f11efa9c2dca63269f8a6/groups/0 HTTP/1.1" 200 - diyhue | 2024-07-24 14:02:04,097 - werkzeug - INFO - 10.200.200.1 - - [24/Jul/2024 14:02:04] "GET /api/811c3738485f11efa9c2dca63269f8a6/config/swupdate2 HTTP/1.1" 200 - diyhue | 2024-07-24 14:02:09,102 - werkzeug - INFO - 10.200.200.1 - - [24/Jul/2024 14:02:09] "GET /api/811c3738485f11efa9c2dca63269f8a6/config/swupdate2 HTTP/1.1" 200 - diyhue | 2024-07-24 14:02:09,107 - werkzeug - INFO - 10.200.200.1 - - [24/Jul/2024 14:02:09] "GET /api/811c3738485f11efa9c2dca63269f8a6/groups/0 HTTP/1.1" 200 - diyhue | 2024-07-24 14:02:11,350 - services.stateFetch - INFO - start lights sync diyhue | 2024-07-24 14:02:15,007 - werkzeug - INFO - 10.200.200.1 - - [24/Jul/2024 14:02:15] "GET /api/811c3738485f11efa9c2dca63269f8a6/config/swupdate2 HTTP/1.1" 200 - diyhue | 2024-07-24 14:02:15,012 - werkzeug - INFO - 10.200.200.1 - - [24/Jul/2024 14:02:15] "GET /api/811c3738485f11efa9c2dca63269f8a6/groups/0 HTTP/1.1" 200 - diyhue | 2024-07-24 14:02:20,001 - werkzeug - INFO - 10.200.200.1 - - [24/Jul/2024 14:02:20] "GET /api/811c3738485f11efa9c2dca63269f8a6/groups/0 HTTP/1.1" 200 - diyhue | 2024-07-24 14:02:20,002 - werkzeug - INFO - 10.200.200.1 - - [24/Jul/2024 14:02:20] "GET /api/811c3738485f11efa9c2dca63269f8a6/config/swupdate2 HTTP/1.1" 200 - diyhue | 2024-07-24 14:02:22,351 - services.stateFetch - INFO - start lights sync diyhue | 2024-07-24 14:02:25,004 - werkzeug - INFO - 10.200.200.1 - - [24/Jul/2024 14:02:25] "GET /api/811c3738485f11efa9c2dca63269f8a6/config/swupdate2 HTTP/1.1" 200 - diyhue | 2024-07-24 14:02:25,009 - werkzeug - INFO - 10.200.200.1 - - [24/Jul/2024 14:02:25] "GET /api/811c3738485f11efa9c2dca63269f8a6/groups/0 HTTP/1.1" 200 -

mariusmotea commented 3 months ago

I made some debug on the discovery script and found the issue. The proxy host from Hetzner has now ipv6 enable, so if you have ipv6 home every request will come with unique ipv6 ip address, so there is not possible to have a match for the requests coming from the same network. I will look for a solution

mariusmotea commented 3 months ago

Things are even more complicated, for example i tried to implement the detection of ipv6 prefix but i still get empty results. It looks like the diyhue docker container use ipv4 to send the requests but all my other device are using ipv6, so it don't detect anything. Maybe cutting ipv6 temporary on the router will help to force ipv4 fallback. If your diyhue instance use ipv6 it may work now, but i was unable to test it.

hendriksen-mark commented 3 months ago

Yesterday i tested docker, instal script and HA all on ipv4 and every time it was registrating fine, i have ipv6 blocked via pi-hole

hendriksen-mark commented 3 months ago

Discovery is now included in the config request, if enabled it stays on.