bwssytems / ha-bridge

Home automation bridge that emulates a Philips Hue light system and can control other systems such as a Vera, Harmony Hub, Nest, MiLight bulbs or any other system that has an http/https/tcp/udp interface. This is a compact impl to run on small format computers. This is impl started from this project https://github.com/armzilla/amazon-echo-ha-bridge.
Apache License 2.0
1.45k stars 199 forks source link

Discovery issues from Echo Dot 2nd Gen - potential fix #860

Closed Malarcy closed 6 years ago

Malarcy commented 6 years ago

I have found discovery in my setup to be very hit and miss and for the last two weeks almost completely impossible (worked perhaps once every 50 times).

I noted that new devices on my real HUE bridge were always found

After a lot of tracing and debugging I hit upon the idea of it being a timing issue - I think ha-bridge is responding too quickly for the dot to be ready to receive the response to the M-SEARCH (there a fair amount of upnp traffic on my network, chrome seems to search, as does plex as does my sky tv box - but I am not "flooded" with responses).

I made a quick and dirty change in Upnplistener.java inserting a Thread.sleep(1500) before the call to send the template3 response via sendUDPResponse.

The echo then completes the handshake and I see " hue lights list requested by user" etc.

This - in my setup at least has resulted in 100% stability in discovery.

I offer this purely as info - it may be something that is totally local to me and therefore shouldn't be considered for the code base but I have had poor discovery ever since I started using ha-bridge - and now it's 100% ( from the DOT - I also have an echo plus - that doesn't seem to play nicely - but I will worry about that another day)

bwssytems commented 6 years ago

That is great news! I will put that in the next release. Will also allow adjusting for timeout. That may be the reason when I do a discover on a gen 1, it asks multiple times.

Malarcy commented 6 years ago

I spent a bit of time reading the upnp specs - seems that the MX value in the search should be used to get the devices that are replying to stagger their responses - but it also says its max value is 5 and if it gets a higher value it should assume 5 - I note the echo dot sets it mx to 15 (I think) - I was going to put some random between .05 and 5 seconds in - but the quick and dirty of 1.5 (1500 ms) seemed to nail it.

don't know if we need it on all three template types but i see the dot only asks for the last type in it's search - maybe it ignores the other replies whenever they come.

either way - hope it helps - and let me know if you want a test of that particular piece ahead of release - happy to throw it into my setup.

bwssytems commented 6 years ago

They way I was going to implement it was the delay between each template send starting with delaying the first template.

bwssytems commented 6 years ago

So, looking at the spec for MX, it is to randomize between 0 and seconds where MX is between 1 and 5. So as many times as this is used, I'll jsut make sure the value set does not exceed 5 seconds for the 3 responses.

Malarcy commented 6 years ago

I wonder how sensitive the dot is to the timing. I will double check but I thought the dot set the mx to 15. I know the specs say 5 ( or assume 5 is mx > 5) is the max but I wonder if dot does that (15) because it needs longer and maybe the HUE chooses to use random up to 15 rather than random > 5.

On 29 Dec 2017, at 17:15, BWS Systems notifications@github.com wrote:

So, looking at the spec for MX, it is to randomize between 0 and seconds where MX is between 1 and 5. So as many times as this is used, I'll jsut make sure the value set does not exceed 5 seconds for the 3 responses.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

bwssytems commented 6 years ago

My implementation has a max of 15000. So that should cover it,

pbrisebois commented 6 years ago

will the fix be a new .jar file? If so, I cannot find a new .jar file for 5.2.0, the latest I can find is 5.1.0.

bwssytems commented 6 years ago

Please go test RC version in #863

F3ELING1337 commented 6 years ago

Hello, I'm also experiencing this issue. Tried several versions (4.5.9, 5.0.0, 5.1.0) and was hoping that 5.2.0RC1 would fix this but sadly not: Device: Echo Dot 2nd Generation Dot Firmware Version: 597465220 Dot IP: 192.168.1.121 Habridge Version: 5.2.0RC1 Habridge IP: 192.168.1.108 Upnp Port: 50000 Webserver Port: 80

Log:

2018-01-04 17:09:40,461 [main] INFO com.bwssystems.HABridge.HABridge - HA Bridge (v5.2.0RC1) starting.... 2018-01-04 17:09:40,594 [main] INFO com.bwssystems.HABridge.BridgeSettings - reading from config file: data/habridge.config 2018-01-04 17:09:42,777 [main] INFO com.bwssystems.HABridge.HABridge - HA Bridge initializing.... 2018-01-04 17:09:43,719 [main] INFO spark.staticfiles.StaticFilesConfiguration - StaticResourceHandler configured with folder = /public 2018-01-04 17:09:43,872 [main] INFO com.bwssystems.HABridge.SystemControl - System control service started.... 2018-01-04 17:09:44,207 [main] INFO com.bwssystems.HABridge.util.UDPDatagramSender - Initializing UDP response Socket... 2018-01-04 17:09:44,223 [main] INFO com.bwssystems.HABridge.util.UDPDatagramSender - UDP response Seocket initialized to: 50000 2018-01-04 17:09:44,267 [main] INFO com.bwssystems.HABridge.plugins.harmony.HarmonyHome - Harmony Home created. No Harmony devices configured. 2018-01-04 17:09:44,284 [main] INFO com.bwssystems.HABridge.plugins.NestBridge.NestHome - Nest Home created. No Nest configured. 2018-01-04 17:09:44,293 [main] INFO com.bwssystems.HABridge.plugins.hue.HueHome - Hue passthru Home created. No Hue passtrhu systems configured. 2018-01-04 17:09:44,302 [main] INFO com.bwssystems.HABridge.plugins.hal.HalHome - HAL Home created. No HAL devices configured. 2018-01-04 17:09:44,310 [main] INFO com.bwssystems.HABridge.plugins.mqtt.MQTTHome - MQTT Home created. No MQTT Clients configured. 2018-01-04 17:09:44,319 [main] INFO com.bwssystems.HABridge.plugins.hass.HassHome - HomeAssistant Home created. No HomeAssistants configured. 2018-01-04 17:09:44,327 [main] INFO com.bwssystems.HABridge.plugins.homewizard.HomeWizardHome - HomeWizard Home created. No HomeWizard gateways configured. 2018-01-04 17:09:44,334 [main] INFO com.bwssystems.HABridge.plugins.exec.CommandHome - Command Home for system program execution created. 2018-01-04 17:09:44,365 [main] INFO com.bwssystems.HABridge.plugins.http.HTTPHome - Http Home created. 2018-01-04 17:09:44,373 [main] INFO com.bwssystems.HABridge.plugins.tcp.TCPHome - TCP Home created. 2018-01-04 17:09:44,387 [main] INFO com.bwssystems.HABridge.plugins.udp.UDPHome - UDP Home created. 2018-01-04 17:09:44,394 [main] INFO com.bwssystems.HABridge.plugins.vera.VeraHome - Vera Home created. No Veras configured. 2018-01-04 17:09:44,402 [main] INFO com.bwssystems.HABridge.plugins.fibaro.FibaroHome - Fibaro Home created. No Fibaros configured. 2018-01-04 17:09:44,411 [main] INFO com.bwssystems.HABridge.plugins.domoticz.DomoticzHome - Domoticz Home created. No Domoticz devices configured. 2018-01-04 17:09:44,419 [main] INFO com.bwssystems.HABridge.plugins.somfy.SomfyHome - Somfy Home created. No Somfys configured. 2018-01-04 17:09:44,435 [main] INFO com.bwssystems.HABridge.plugins.lifx.LifxHome - LifxDevice Home created. No LifxDevices configured. 2018-01-04 17:09:44,448 [main] INFO com.bwssystems.HABridge.plugins.openhab.OpenHABHome - OpenHAB Home created. No OpenHABs configured. 2018-01-04 17:09:44,458 [main] INFO com.bwssystems.HABridge.plugins.fhem.FHEMHome - FHEM Home created. No FHEMs configured. 2018-01-04 17:09:44,535 [Thread-0] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - == Spark has ignited ... 2018-01-04 17:09:44,546 [Thread-0] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - >> Listening on 0.0.0.0:80 2018-01-04 17:09:44,639 [main] WARN com.bwssystems.HABridge.dao.GroupRepository - Error reading the file: data/group.db - Does not exist or is not readable. continuing... 2018-01-04 17:09:44,642 [main] INFO com.bwssystems.HABridge.devicemanagmeent.DeviceResource - HABridge device management service started.... 2018-01-04 17:09:44,921 [main] INFO com.bwssystems.HABridge.hue.HueMulator - Hue emulator service started.... 2018-01-04 17:09:45,156 [main] INFO com.bwssystems.HABridge.HABridge - Traceupnp: upnp config address: 192.168.1.108-useIface:false on web server: 0.0.0.0:80 2018-01-04 17:09:45,162 [main] INFO com.bwssystems.HABridge.upnp.UpnpSettingsResource - Description xml service started.... 2018-01-04 17:09:45,211 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - UPNP Discovery Listener starting.... 2018-01-04 17:09:45,216 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: br-9f6afc1fa6d6 valid usable IP address: /172.21.0.1 2018-01-04 17:09:45,218 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding br-9f6afc1fa6d6 to our upnp join interface set. 2018-01-04 17:09:45,222 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: vetha80a2ba valid usable IP address: /169.254.9.232 2018-01-04 17:09:45,224 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding vetha80a2ba to our upnp join interface set. 2018-01-04 17:09:45,228 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: br-69093c41738c valid usable IP address: /169.254.223.93 2018-01-04 17:09:45,230 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: br-69093c41738c valid usable IP address: /172.20.0.1 2018-01-04 17:09:45,232 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding br-69093c41738c to our upnp join interface set. 2018-01-04 17:09:45,234 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: br-7aea25dc9958 valid usable IP address: /172.19.0.1 2018-01-04 17:09:45,236 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding br-7aea25dc9958 to our upnp join interface set. 2018-01-04 17:09:45,240 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: vethd5f9907 valid usable IP address: /169.254.126.102 2018-01-04 17:09:45,242 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding vethd5f9907 to our upnp join interface set. 2018-01-04 17:09:45,246 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: br-c83e630bd02e valid usable IP address: /169.254.166.204 2018-01-04 17:09:45,249 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: br-c83e630bd02e valid usable IP address: /172.18.0.1 2018-01-04 17:09:45,250 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding br-c83e630bd02e to our upnp join interface set. 2018-01-04 17:09:45,253 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: docker0 valid usable IP address: /172.17.0.1 2018-01-04 17:09:45,255 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding docker0 to our upnp join interface set. 2018-01-04 17:09:45,261 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: eth0 valid usable IP address: /192.168.1.108 2018-01-04 17:09:45,263 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding eth0 to our upnp join interface set. 2018-01-04 17:09:45,266 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: lo valid usable IP address: /127.0.0.1 2018-01-04 17:09:45,268 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding lo to our upnp join interface set. 2018-01-04 17:09:45,270 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - UPNP Discovery Listener running and ready.... 2018-01-04 17:11:00,014 [main] DEBUG com.bwssystems.HABridge.upnp.UpnpListener - sendUpnpNotify notifyTemplate is <<<NOTIFY * HTTP/1.1

HOST: 239.255.255.250:1900

CACHE-CONTROL: max-age=100

LOCATION: http://192.168.1.108:80/description.xml

SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0

NTS: ssdp:alive

hue-bridgeid: B827EBFFFE8644CD

NT: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

USN: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

2018-01-04 17:11:00,205 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: SSDP M-SEARCH packet from 192.168.1.121:50000 2018-01-04 17:11:01,719 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 1 with response address: 192.168.1.108:80 to address: /192.168.1.121:50000 2018-01-04 17:11:01,724 [main] DEBUG com.bwssystems.HABridge.upnp.UpnpListener - Sending response string: <<<HTTP/1.1 200 OK

HOST: 239.255.255.250:1900

CACHE-CONTROL: max-age=100

EXT:

LOCATION: http://192.168.1.108:80/description.xml

SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0

hue-bridgeid: B827EBFFFE8644CD

ST: upnp:rootdevice

USN: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd::upnp:rootdevice

2018-01-04 17:11:03,240 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 2 with response address: 192.168.1.108:80 to address: /192.168.1.121:50000 2018-01-04 17:11:03,245 [main] DEBUG com.bwssystems.HABridge.upnp.UpnpListener - Sending response string: <<<HTTP/1.1 200 OK

HOST: 239.255.255.250:1900

CACHE-CONTROL: max-age=100

EXT:

LOCATION: http://192.168.1.108:80/description.xml

SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0

hue-bridgeid: B827EBFFFE8644CD

ST: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

USN: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

2018-01-04 17:11:04,759 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 3 with response address: 192.168.1.108:80 to address: /192.168.1.121:50000 2018-01-04 17:11:04,763 [main] DEBUG com.bwssystems.HABridge.upnp.UpnpListener - Sending response string: <<<HTTP/1.1 200 OK

HOST: 239.255.255.250:1900

CACHE-CONTROL: max-age=100

EXT:

LOCATION: http://192.168.1.108:80/description.xml

SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0

hue-bridgeid: B827EBFFFE8644CD

ST: urn:schemas-upnp-org:device:basic:1

USN: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

2018-01-04 17:11:04,768 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: SSDP M-SEARCH packet from 192.168.1.121:50000 2018-01-04 17:11:05,025 [qtp25643290-7] INFO com.bwssystems.HABridge.upnp.UpnpSettingsResource - Traceupnp: request of description.xml from: 192.168.1.121:80 filled in with address: 192.168.1.108:80 2018-01-04 17:11:05,264 [qtp25643290-17] INFO com.bwssystems.HABridge.hue.HueMulator - Traceupnp: hue lights list requested by user: 8giiV6M6J5EYTVzC1DoAG4k74dpswkSpMfWwAdxS from address: 192.168.1.121 2018-01-04 17:11:06,282 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 1 with response address: 192.168.1.108:80 to address: /192.168.1.121:50000 2018-01-04 17:11:06,286 [main] DEBUG com.bwssystems.HABridge.upnp.UpnpListener - Sending response string: <<<HTTP/1.1 200 OK

HOST: 239.255.255.250:1900

CACHE-CONTROL: max-age=100

EXT:

LOCATION: http://192.168.1.108:80/description.xml

SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0

hue-bridgeid: B827EBFFFE8644CD

ST: upnp:rootdevice

USN: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd::upnp:rootdevice

2018-01-04 17:11:07,802 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 2 with response address: 192.168.1.108:80 to address: /192.168.1.121:50000 2018-01-04 17:11:07,806 [main] DEBUG com.bwssystems.HABridge.upnp.UpnpListener - Sending response string: <<<HTTP/1.1 200 OK

HOST: 239.255.255.250:1900

CACHE-CONTROL: max-age=100

EXT:

LOCATION: http://192.168.1.108:80/description.xml

SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0

hue-bridgeid: B827EBFFFE8644CD

ST: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

USN: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

2018-01-04 17:11:09,320 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 3 with response address: 192.168.1.108:80 to address: /192.168.1.121:50000 2018-01-04 17:11:09,324 [main] DEBUG com.bwssystems.HABridge.upnp.UpnpListener - Sending response string: <<<HTTP/1.1 200 OK

HOST: 239.255.255.250:1900

CACHE-CONTROL: max-age=100

EXT:

LOCATION: http://192.168.1.108:80/description.xml

SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0

hue-bridgeid: B827EBFFFE8644CD

ST: urn:schemas-upnp-org:device:basic:1

USN: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

2018-01-04 17:11:09,331 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: SSDP M-SEARCH packet from 192.168.1.122:50000 2018-01-04 17:11:10,601 [qtp25643290-14] INFO com.bwssystems.HABridge.upnp.UpnpSettingsResource - Traceupnp: request of description.xml from: 192.168.1.121:80 filled in with address: 192.168.1.108:80 2018-01-04 17:11:10,839 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 1 with response address: 192.168.1.108:80 to address: /192.168.1.122:50000 2018-01-04 17:11:10,841 [main] DEBUG com.bwssystems.HABridge.upnp.UpnpListener - Sending response string: <<<HTTP/1.1 200 OK

HOST: 239.255.255.250:1900

CACHE-CONTROL: max-age=100

EXT:

LOCATION: http://192.168.1.108:80/description.xml

SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0

hue-bridgeid: B827EBFFFE8644CD

ST: upnp:rootdevice

USN: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd::upnp:rootdevice

2018-01-04 17:11:10,852 [qtp25643290-13] INFO com.bwssystems.HABridge.hue.HueMulator - Traceupnp: hue lights list requested by user: 8giiV6M6J5EYTVzC1DoAG4k74dpswkSpMfWwAdxS from address: 192.168.1.121 2018-01-04 17:11:12,354 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 2 with response address: 192.168.1.108:80 to address: /192.168.1.122:50000 2018-01-04 17:11:12,360 [main] DEBUG com.bwssystems.HABridge.upnp.UpnpListener - Sending response string: <<<HTTP/1.1 200 OK

HOST: 239.255.255.250:1900

CACHE-CONTROL: max-age=100

EXT:

LOCATION: http://192.168.1.108:80/description.xml

SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0

hue-bridgeid: B827EBFFFE8644CD

ST: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

USN: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

2018-01-04 17:11:13,876 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 3 with response address: 192.168.1.108:80 to address: /192.168.1.122:50000 2018-01-04 17:11:13,881 [main] DEBUG com.bwssystems.HABridge.upnp.UpnpListener - Sending response string: <<<HTTP/1.1 200 OK

HOST: 239.255.255.250:1900

CACHE-CONTROL: max-age=100

EXT:

LOCATION: http://192.168.1.108:80/description.xml

SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0

hue-bridgeid: B827EBFFFE8644CD

ST: urn:schemas-upnp-org:device:basic:1

USN: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

2018-01-04 17:11:13,888 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: SSDP M-SEARCH packet from 192.168.1.122:50000 2018-01-04 17:11:14,012 [qtp25643290-10] INFO com.bwssystems.HABridge.upnp.UpnpSettingsResource - Traceupnp: request of description.xml from: 192.168.1.122:80 filled in with address: 192.168.1.108:80 2018-01-04 17:11:14,276 [qtp25643290-20] INFO com.bwssystems.HABridge.hue.HueMulator - Traceupnp: hue lights list requested by user: 8giiV6M6J5EYTVzC1DoAG4k74dpswkSpMfWwAdxS from address: 192.168.1.122 2018-01-04 17:11:15,401 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 1 with response address: 192.168.1.108:80 to address: /192.168.1.122:50000 2018-01-04 17:11:15,407 [main] DEBUG com.bwssystems.HABridge.upnp.UpnpListener - Sending response string: <<<HTTP/1.1 200 OK

HOST: 239.255.255.250:1900

CACHE-CONTROL: max-age=100

EXT:

LOCATION: http://192.168.1.108:80/description.xml

SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0

hue-bridgeid: B827EBFFFE8644CD

ST: upnp:rootdevice

USN: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd::upnp:rootdevice

2018-01-04 17:11:16,924 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 2 with response address: 192.168.1.108:80 to address: /192.168.1.122:50000 2018-01-04 17:11:16,929 [main] DEBUG com.bwssystems.HABridge.upnp.UpnpListener - Sending response string: <<<HTTP/1.1 200 OK

HOST: 239.255.255.250:1900

CACHE-CONTROL: max-age=100

EXT:

LOCATION: http://192.168.1.108:80/description.xml

SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0

hue-bridgeid: B827EBFFFE8644CD

ST: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

USN: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

2018-01-04 17:11:18,439 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 3 with response address: 192.168.1.108:80 to address: /192.168.1.122:50000 2018-01-04 17:11:18,442 [main] DEBUG com.bwssystems.HABridge.upnp.UpnpListener - Sending response string: <<<HTTP/1.1 200 OK

HOST: 239.255.255.250:1900

CACHE-CONTROL: max-age=100

EXT:

LOCATION: http://192.168.1.108:80/description.xml

SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0

hue-bridgeid: B827EBFFFE8644CD

ST: urn:schemas-upnp-org:device:basic:1

USN: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

2018-01-04 17:11:27,302 [main] DEBUG com.bwssystems.HABridge.upnp.UpnpListener - sendUpnpNotify notifyTemplate is <<<NOTIFY * HTTP/1.1

HOST: 239.255.255.250:1900

CACHE-CONTROL: max-age=100

LOCATION: http://192.168.1.108:80/description.xml

SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0

NTS: ssdp:alive

hue-bridgeid: B827EBFFFE8644CD

NT: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

USN: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

2018-01-04 17:11:58,669 [main] DEBUG com.bwssystems.HABridge.upnp.UpnpListener - sendUpnpNotify notifyTemplate is <<<NOTIFY * HTTP/1.1

HOST: 239.255.255.250:1900

CACHE-CONTROL: max-age=100

LOCATION: http://192.168.1.108:80/description.xml

SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0

NTS: ssdp:alive

hue-bridgeid: B827EBFFFE8644CD

NT: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

USN: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

2018-01-04 17:11:58,687 [main] DEBUG com.bwssystems.HABridge.upnp.UpnpListener - sendUpnpNotify notifyTemplate is <<<NOTIFY * HTTP/1.1

HOST: 239.255.255.250:1900

CACHE-CONTROL: max-age=100

LOCATION: http://192.168.1.108:80/description.xml

SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0

NTS: ssdp:alive

hue-bridgeid: B827EBFFFE8644CD

NT: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

USN: uuid:2f402f80-da50-11e1-9b23-b827eb8644cd

I've tried several UPNP send delays (1000, 1500, 2000, 3000, 4500): No success. Am I doing something wrong? My Harmony Hub has no problems finding the bridge so I suspect the Echo being the culprit.

Malarcy commented 6 years ago

Quick test tonight on this

Echo Dot 2nd GEN - found bridge and device 1st attempt - working as expected.

Echo Plus - found bridge and (additional to 1st test) device - this had NEVER worked before - even with my dirty hack on the timing - so working as expected.

Looking good for now - will test more tomorrow (including alexa app on IOS for discovery as well).

bwssytems commented 6 years ago

Please post your run environments and IPs of your devices please.

bwssytems commented 6 years ago

@F3ELING1337 It seems that the dot finds the bridge and does ask for the lights list. What is on IP 1.122?

F3ELING1337 commented 6 years ago

Sorry 1.122 is just another Echo Dot 2nd Gen with exactly same firmware version. Tried only one Dot, two at the same time, only the other Dot, no success. Yeah I saw that the Dot seems to ask for the lights but again my Harmony Hub had no problems finding the bridge and listing all lights correctly. So sadly no misconfiguration there :-( Appreciating your input!

bwssytems commented 6 years ago

@F3ELING1337 in the Amazon Echo App on your phone, do a add scene as it will go and discover again but it seems it may be different.

Malarcy commented 6 years ago

If you have two echo devices then if either of them find the bridge and devices then the other won’t report it as new ( it does however learn how to drive it so you can power off the one that discovers first and the other can still drive ).

I staggered my testing. Powered off one echo. Created a new device in the bridge and ran discovery.

Then swapped over crated another device and did it again.

In my case both found the device I added just before the test for the and both echos can drive both devices.

Suggest a double check that the devices haven’t sneaked in (on the app or the web page )

It seems weird because once I got as far as the echo devise asking for the “hue lights” it’s always worked from there on.

Is it worth checking that the get hue api call is returning what is expected ( question for bws )

On 4 Jan 2018, at 22:10, BWS Systems notifications@github.com wrote:

@F3ELING1337 in the Amazon Echo App on your phone, do a add scene as it will go and discover again but it seems it may be different.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

bwssytems commented 6 years ago

@Malarcy What being expected is something I am looking for. I may need someone to get the replies from a current V2 Hue Hub to validate.

Malarcy commented 6 years ago

I can do that. I will grab the request exchange between dot and hue hub (will be tomorrow before I can do that )

I was thinking more of checking what this particular users instance of habridge is returning to the get hue call since it’s working for me we could maybe take a look and see if there’s something in a device name or some other attribute that could give a hint to the echo not processing the reply

I am testing in a clean install with jus a couple of devices with easily spoken names (teddy and fiction - don’t ask ) maybe there’s more things going on with a bigger list for example.

On 4 Jan 2018, at 22:31, BWS Systems notifications@github.com wrote:

@Malarcy What being expected is something I am looking for. I may need someone to get the replies from a current V2 Hue Hub to validate.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

F3ELING1337 commented 6 years ago

@bwssytems Today I tried what you suggested. I unplugged 1 of my Dots and asked to discover scenes, here are the results:

2018-01-05 17:16:50,162 [main] INFO com.bwssystems.HABridge.HABridge - HA Bridge (v5.2.0RC1) starting.... 2018-01-05 17:16:50,288 [main] INFO com.bwssystems.HABridge.BridgeSettings - reading from config file: data/habridge.config 2018-01-05 17:16:52,355 [main] INFO com.bwssystems.HABridge.HABridge - HA Bridge initializing.... 2018-01-05 17:16:53,246 [main] INFO spark.staticfiles.StaticFilesConfiguration - StaticResourceHandler configured with folder = /public 2018-01-05 17:16:53,391 [main] INFO com.bwssystems.HABridge.SystemControl - System control service started.... 2018-01-05 17:16:53,719 [main] INFO com.bwssystems.HABridge.util.UDPDatagramSender - Initializing UDP response Socket... 2018-01-05 17:16:53,734 [main] INFO com.bwssystems.HABridge.util.UDPDatagramSender - UDP response Seocket initialized to: 50000 2018-01-05 17:16:53,757 [main] INFO com.bwssystems.HABridge.plugins.harmony.HarmonyHome - Harmony Home created. No Harmony devices configured. 2018-01-05 17:16:53,786 [main] INFO com.bwssystems.HABridge.plugins.NestBridge.NestHome - Nest Home created. No Nest configured. 2018-01-05 17:16:53,794 [main] INFO com.bwssystems.HABridge.plugins.hue.HueHome - Hue passthru Home created. No Hue passtrhu systems configured. 2018-01-05 17:16:53,802 [main] INFO com.bwssystems.HABridge.plugins.hal.HalHome - HAL Home created. No HAL devices configured. 2018-01-05 17:16:53,810 [main] INFO com.bwssystems.HABridge.plugins.mqtt.MQTTHome - MQTT Home created. No MQTT Clients configured. 2018-01-05 17:16:53,819 [main] INFO com.bwssystems.HABridge.plugins.hass.HassHome - HomeAssistant Home created. No HomeAssistants configured. 2018-01-05 17:16:53,826 [main] INFO com.bwssystems.HABridge.plugins.homewizard.HomeWizardHome - HomeWizard Home created. No HomeWizard gateways configured. 2018-01-05 17:16:53,833 [main] INFO com.bwssystems.HABridge.plugins.exec.CommandHome - Command Home for system program execution created. 2018-01-05 17:16:53,862 [main] INFO com.bwssystems.HABridge.plugins.http.HTTPHome - Http Home created. 2018-01-05 17:16:53,870 [main] INFO com.bwssystems.HABridge.plugins.tcp.TCPHome - TCP Home created. 2018-01-05 17:16:53,883 [main] INFO com.bwssystems.HABridge.plugins.udp.UDPHome - UDP Home created. 2018-01-05 17:16:53,890 [main] INFO com.bwssystems.HABridge.plugins.vera.VeraHome - Vera Home created. No Veras configured. 2018-01-05 17:16:53,898 [main] INFO com.bwssystems.HABridge.plugins.fibaro.FibaroHome - Fibaro Home created. No Fibaros configured. 2018-01-05 17:16:53,906 [main] INFO com.bwssystems.HABridge.plugins.domoticz.DomoticzHome - Domoticz Home created. No Domoticz devices configured. 2018-01-05 17:16:53,914 [main] INFO com.bwssystems.HABridge.plugins.somfy.SomfyHome - Somfy Home created. No Somfys configured. 2018-01-05 17:16:53,929 [main] INFO com.bwssystems.HABridge.plugins.lifx.LifxHome - LifxDevice Home created. No LifxDevices configured. 2018-01-05 17:16:53,937 [main] INFO com.bwssystems.HABridge.plugins.openhab.OpenHABHome - OpenHAB Home created. No OpenHABs configured. 2018-01-05 17:16:53,950 [main] INFO com.bwssystems.HABridge.plugins.fhem.FHEMHome - FHEM Home created. No FHEMs configured. 2018-01-05 17:16:54,106 [main] WARN com.bwssystems.HABridge.dao.GroupRepository - Error reading the file: data/group.db - Does not exist or is not readable. continuing... 2018-01-05 17:16:54,108 [main] INFO com.bwssystems.HABridge.devicemanagmeent.DeviceResource - HABridge device management service started.... 2018-01-05 17:16:54,113 [Thread-0] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - == Spark has ignited ... 2018-01-05 17:16:54,140 [Thread-0] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - >> Listening on 0.0.0.0:80 2018-01-05 17:16:54,406 [main] INFO com.bwssystems.HABridge.hue.HueMulator - Hue emulator service started.... 2018-01-05 17:16:54,649 [main] INFO com.bwssystems.HABridge.HABridge - Traceupnp: upnp config address: 192.168.1.108-useIface:false on web server: 0.0.0.0:80 2018-01-05 17:16:54,655 [main] INFO com.bwssystems.HABridge.upnp.UpnpSettingsResource - Description xml service started.... 2018-01-05 17:16:54,705 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - UPNP Discovery Listener starting.... 2018-01-05 17:16:54,709 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: br-9f6afc1fa6d6 valid usable IP address: /172.21.0.1 2018-01-05 17:16:54,712 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding br-9f6afc1fa6d6 to our upnp join interface set. 2018-01-05 17:16:54,716 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: vetha80a2ba valid usable IP address: /169.254.9.232 2018-01-05 17:16:54,717 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding vetha80a2ba to our upnp join interface set. 2018-01-05 17:16:54,721 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: br-69093c41738c valid usable IP address: /169.254.223.93 2018-01-05 17:16:54,724 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: br-69093c41738c valid usable IP address: /172.20.0.1 2018-01-05 17:16:54,726 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding br-69093c41738c to our upnp join interface set. 2018-01-05 17:16:54,728 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: br-7aea25dc9958 valid usable IP address: /172.19.0.1 2018-01-05 17:16:54,730 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding br-7aea25dc9958 to our upnp join interface set. 2018-01-05 17:16:54,734 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: vethd5f9907 valid usable IP address: /169.254.126.102 2018-01-05 17:16:54,736 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding vethd5f9907 to our upnp join interface set. 2018-01-05 17:16:54,740 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: br-c83e630bd02e valid usable IP address: /169.254.166.204 2018-01-05 17:16:54,742 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: br-c83e630bd02e valid usable IP address: /172.18.0.1 2018-01-05 17:16:54,744 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding br-c83e630bd02e to our upnp join interface set. 2018-01-05 17:16:54,747 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: docker0 valid usable IP address: /172.17.0.1 2018-01-05 17:16:54,749 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding docker0 to our upnp join interface set. 2018-01-05 17:16:54,754 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: eth0 valid usable IP address: /192.168.1.108 2018-01-05 17:16:54,756 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding eth0 to our upnp join interface set. 2018-01-05 17:16:54,759 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: lo valid usable IP address: /127.0.0.1 2018-01-05 17:16:54,761 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding lo to our upnp join interface set. 2018-01-05 17:16:54,763 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - UPNP Discovery Listener running and ready.... 2018-01-05 17:17:54,098 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: SSDP M-SEARCH packet from 192.168.1.121:50000 2018-01-05 17:17:55,612 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 1 with response address: 192.168.1.108:80 to address: /192.168.1.121:50000 2018-01-05 17:17:57,129 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 2 with response address: 192.168.1.108:80 to address: /192.168.1.121:50000 2018-01-05 17:17:58,646 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 3 with response address: 192.168.1.108:80 to address: /192.168.1.121:50000 2018-01-05 17:17:58,652 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: SSDP M-SEARCH packet from 192.168.1.121:50000 2018-01-05 17:17:58,748 [qtp25643290-11] INFO com.bwssystems.HABridge.upnp.UpnpSettingsResource - Traceupnp: request of description.xml from: 192.168.1.121:80 filled in with address: 192.168.1.108:80 2018-01-05 17:17:58,989 [qtp25643290-20] INFO com.bwssystems.HABridge.hue.HueMulator - Traceupnp: hue lights list requested by user: 8giiV6M6J5EYTVzC1DoAG4k74dpswkSpMfWwAdxS from address: 192.168.1.121 2018-01-05 17:18:00,168 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 1 with response address: 192.168.1.108:80 to address: /192.168.1.121:50000 2018-01-05 17:18:01,686 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 2 with response address: 192.168.1.108:80 to address: /192.168.1.121:50000 2018-01-05 17:18:03,203 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 3 with response address: 192.168.1.108:80 to address: /192.168.1.121:50000 2018-01-05 17:18:03,309 [qtp25643290-19] INFO com.bwssystems.HABridge.upnp.UpnpSettingsResource - Traceupnp: request of description.xml from: 192.168.1.121:80 filled in with address: 192.168.1.108:80 2018-01-05 17:18:03,588 [qtp25643290-13] INFO com.bwssystems.HABridge.hue.HueMulator - Traceupnp: hue lights list requested by user: 8giiV6M6J5EYTVzC1DoAG4k74dpswkSpMfWwAdxS from address: 192.168.1.121

If it helps something, here's my device: [{"id":"1","uniqueid":"00:17:88:5E:D3:01-01","name":"Testdev","mapType":"httpDevice","offUrl":"[{\"item\":\"http://fhem.local/off\",\"type\":\"httpDevice\",\"httpVerb\":\"GET\",\"contentType\":\"text/html\"}]","onUrl":"[{\"item\":\"http://fhem.local/on\",\"type\":\"httpDevice\",\"httpVerb\":\"GET\",\"contentType\":\"text/html\"}]","inactive":false,"noState":false,"offState":false,"deviceState":{"on":false,"bri":0,"alert":"none","reachable":true}}]

Again no discovery :-(

bwssytems commented 6 years ago

@F3ELING1337 Thanks for trying.

joergbeyer commented 6 years ago

I also have an 2nd gen echo that does not discover any devices that are well configures in habridge, see https://github.com/bwssytems/ha-bridge/issues/878

I also tried it with a 1500ms delay, self compiled like this UpnpListener.java:

from the void sendUpnpResponse(InetAddress requester, int sourcePort) method:

... discoveryResponse = String.format(responseTemplate3, Configuration.UPNP_MULTICAST_ADDRESS, Configuration.UPNP_DISCOVERY_PORT, responseAddress, httpServerPort, bridgeId, bridgeSNUUID); if(traceupnp) { log.info("Traceupnp: send upnp discovery template 3 with response address: " + responseAddress + ":" + httpServerPort + " to address: " + requester + ":" + sourcePort); } else log.debug("sendUpnpResponse to address: " + requester + ":" + sourcePort + " discovery responseTemplate3 is <<<" + discoveryResponse + ">>>"); try { Thread.sleep(1500); } catch(InterruptedException e1) { log.debug("interrupted exception", e1); } sendUDPResponse(discoveryResponse.getBytes(), requester, sourcePort); }

unfortunately without luck - does not fix the detection issue for me.