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

Another case of alexa no longer discovering ha-bridge devices.. #1002

Closed whatsalinux closed 6 years ago

whatsalinux commented 6 years ago

Part of me wonders if Alexa is going the route google did of requiring a meethue login, but there's enough weirdness in what I'm able to monitor and log that I might be missing something dumb. So my setup -

I've ru ha-bridge since the echodot came out, maybe two years now? Part of that time I was building the jar and running it on ubuntu xenial, on port 8081, UDP port default 1900, response 50000 . IP always static. A few months ago I moved to using the docker image, on my NAS - worked just as well there. Then last week I tried to add two new items to ha-bridge, and alexa just wouldn't discover them. They were showing up in the habridge api xml just fine. After turning on the habridge upnp and huemulator debug logs I could see my echo dots (have two) requesting the description xml/ lights list, but it never added anything.

I tried removing one of the existing "devices" in the alexa app that was served by ha-bridge, wondering if I'd just misconfigured the new items i was trying to add, just to see if alexa would rediscover the "old" device. It did not. Having added and removed a number of devices to habridge over the years, I noticed my "ID" numbers in habridge were getting into the 50's, and wondered if I was hitting some kind of limit, so I hit the "renumber devices" button and rescanned. Again it would not find my new, or the old removed device. But I noticed that because of the change in numbering at ha-bridge, triggering a device in alexa now ran a different command in habridge, corresponding to what its old ID had been. As another test I maneuvered the "new" habridge item into the ID position of an old item that was still mapped in alexa, and triggered it. It ran fine, so I knew it wasn't a formatting issue in my new item.

I'd experienced alexa refusing to find new items, mostly in the months after I got my dots - often I'd have to clean out the devices and start from scratch as others have noted. Having seen it fail to re-add the one old skill I'd removed I was worried that clearing out alexa's memory might lead to losing all of the existing ones for good - and that's what happened. I have an ecobee and a harmony hub, and it finds those fine after removing them.

Other things I've tried, without success:

When scanning, I try each of triggering from the alexa app, the alexa website @ amazon, and vocally "discover devices".

At some point soon after clearing out my alexa devices, I stopped seeing my echo dots interacting with the habridge via debug logs. To make sure UPNP was actually working on my network, I enabled the UPNP server and listener in Kodi on the Ubuntu box. As soon as I turn that on I see activity from kodi's IP in the habridge debug logs. When I trigger alexa discovery, I'll quickly see more habridge debug log activity from the kodi box, passing along an M-search. But I'm still not seeing any communication between the ha-bridge and the echodots directly, no matter where I run habridge, and no matter what combination of settings I use.

Out of ideas, I went another route. Finding a cheap google home mini for sale, and noting the old ghome apk workaround on the wiki to add habridge, I ordered one, and installed the correct APK. I guess that workaround is broken, because rather than pairing with the habridge, it takes me to the meethue webpage to login.

The last thing I can think to try is to integrate an actual v1 hue bridge. They're DIRT cheap now, under $10, so I'm waiting for that to show up to see if alexa finds it, and if I might be able to then sneak habridge in front of it (will I have any means to set the actual serial number of the hue bridge in habridge, or is that generated randomly and automatically?)

whatsalinux commented 6 years ago

Forgot to mention I also tried different values of UPNP delay.

Here's a log file of 5.2.1 running on port 8008 via java jar command, UDP 1900, response 50000, with huemulator debug to trace. 192.168.1.10 is the lan IP where habridge is running, and also where kodi is running from - the UPNP activity logged is from Kodi scanning for UPNP devices. 192.168.11.7 is the laptop where I have the habridge GUI open. Worth noting that the raspberry pi I also tried running habridge from is on the 192.168.11.0/24 subnet that the echoDots are on, no difference. Habridge had always been on a different subnet to the Dots, without issue since the lans are free to talk to each other.

user@foohost:/home/xbmc/scripts/echoDot/ha-bridge# java -jar -Dupnp.config.address=192.168.1.10 -Dserver.port=8008 target/ha-bridge-5.2.1.jar 2018-09-19 17:16:40,086 [main] INFO com.bwssystems.HABridge.HABridge - HA Bridge startup sequence... 2018-09-19 17:16:40,100 [main] INFO com.bwssystems.HABridge.BridgeSettings - reading from config file: data/habridge.config 2018-09-19 17:16:40,516 [main] INFO com.bwssystems.HABridge.HABridge - HA Bridge (v5.2.1) initializing.... 2018-09-19 17:16:40,527 [main] INFO spark.staticfiles.StaticFilesConfiguration - StaticResourceHandler configured with folder = /public 2018-09-19 17:16:40,548 [main] INFO com.bwssystems.HABridge.SystemControl - System control service started.... 2018-09-19 17:16:40.577:INFO::Thread-0: Logging initialized @738ms to org.eclipse.jetty.util.log.StdErrLog 2018-09-19 17:16:40,601 [main] INFO com.bwssystems.HABridge.util.UDPDatagramSender - Initializing UDP response Socket... 2018-09-19 17:16:40,607 [main] INFO com.bwssystems.HABridge.util.UDPDatagramSender - UDP response Socket initialized to: 50000 2018-09-19 17:16:40,610 [main] INFO com.bwssystems.HABridge.plugins.http.HTTPHome - HTTP Home created. 2018-09-19 17:16:40,614 [main] INFO com.bwssystems.HABridge.plugins.harmony.HarmonyHome - Harmony Home created. 2018-09-19 17:16:40,640 [Thread-0] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - == Spark has ignited ... 2018-09-19 17:16:40,644 [Thread-0] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - >> Listening on 192.168.1.10:8008 2018-09-19 17:16:40.651:INFO:oejs.Server:Thread-0: jetty-9.4.z-SNAPSHOT 2018-09-19 17:16:40.691:INFO:oejs.session:Thread-0: DefaultSessionIdManager workerName=node0 2018-09-19 17:16:40.691:INFO:oejs.session:Thread-0: No SessionScavenger set, using defaults 2018-09-19 17:16:40.696:INFO:oejs.session:Thread-0: Scavenging every 660000ms 2018-09-19 17:16:40.712:INFO:oejs.AbstractConnector:Thread-0: Started ServerConnector@1212b2e6{HTTP/1.1,[http/1.1]}{192.168.1.10:8008} 2018-09-19 17:16:40.715:INFO:oejs.Server:Thread-0: Started @877ms 2018-09-19 17:16:40,905 [main] INFO com.bwssystems.HABridge.plugins.harmony.HarmonyServer - setup initiated .... Sep 19, 2018 5:16:41 PM com.fasterxml.jackson.databind.ext.Java7Support WARNING: Unable to load JDK7 types (annotations, java.nio.file.Path): no Java7 support added 2018-09-19 17:16:42,353 [main] INFO com.bwssystems.HABridge.plugins.harmony.HarmonyServer - activity changed: [22791282] Watch XBMC 2018-09-19 17:16:42,354 [main] INFO com.bwssystems.HABridge.plugins.NestBridge.NestHome - Nest Home created. No Nest configured. 2018-09-19 17:16:42,359 [main] INFO com.bwssystems.HABridge.plugins.hue.HueHome - Hue passthru Home created. No Hue passtrhu systems configured. 2018-09-19 17:16:42,362 [main] INFO com.bwssystems.HABridge.plugins.hal.HalHome - HAL Home created. No HAL devices configured. 2018-09-19 17:16:42,363 [main] INFO com.bwssystems.HABridge.plugins.mqtt.MQTTHome - MQTT Home created. No MQTT Clients configured. 2018-09-19 17:16:42,364 [main] INFO com.bwssystems.HABridge.plugins.hass.HassHome - HomeAssistant Home created. No HomeAssistants configured. 2018-09-19 17:16:42,365 [main] INFO com.bwssystems.HABridge.plugins.homewizard.HomeWizardHome - HomeWizard Home created. No HomeWizard gateways configured. 2018-09-19 17:16:42,365 [main] INFO com.bwssystems.HABridge.plugins.exec.CommandHome - Command Home for system program execution created. 2018-09-19 17:16:42,366 [main] INFO com.bwssystems.HABridge.plugins.tcp.TCPHome - TCP Home created. 2018-09-19 17:16:42,367 [main] INFO com.bwssystems.HABridge.plugins.udp.UDPHome - UDP Home created. 2018-09-19 17:16:42,368 [main] INFO com.bwssystems.HABridge.plugins.vera.VeraHome - Vera Home created. No Veras configured. 2018-09-19 17:16:42,368 [main] INFO com.bwssystems.HABridge.plugins.fibaro.FibaroHome - Fibaro Home created. No Fibaros configured. 2018-09-19 17:16:42,369 [main] INFO com.bwssystems.HABridge.plugins.domoticz.DomoticzHome - Domoticz Home created. No Domoticz devices configured. 2018-09-19 17:16:42,370 [main] INFO com.bwssystems.HABridge.plugins.somfy.SomfyHome - Somfy Home created. No Somfys configured. 2018-09-19 17:16:42,371 [main] INFO com.bwssystems.HABridge.plugins.lifx.LifxHome - LifxDevice Home created. No LifxDevices configured. 2018-09-19 17:16:42,372 [main] INFO com.bwssystems.HABridge.plugins.openhab.OpenHABHome - OpenHAB Home created. No OpenHABs configured. 2018-09-19 17:16:42,373 [main] INFO com.bwssystems.HABridge.plugins.fhem.FHEMHome - FHEM Home created. No FHEMs configured. 2018-09-19 17:16:42,375 [main] INFO com.bwssystems.HABridge.plugins.broadlink.BroadlinkHome - Broadlink Home created. No Broadlinks configured. 2018-09-19 17:16:42,384 [main] WARN com.bwssystems.HABridge.dao.GroupRepository - Error reading the file: data/group.db - Does not exist or is not readable. continuing... 2018-09-19 17:16:42,384 [main] INFO com.bwssystems.HABridge.devicemanagmeent.DeviceResource - HABridge device management service started.... 2018-09-19 17:16:42,400 [main] INFO com.bwssystems.HABridge.hue.HueMulator - Hue emulator service started.... 2018-09-19 17:16:42,415 [main] INFO com.bwssystems.HABridge.HABridge - Traceupnp: upnp config address: 192.168.1.10-useIface:true on web server: 192.168.1.10:8008 2018-09-19 17:16:42,416 [main] INFO com.bwssystems.HABridge.upnp.UpnpSettingsResource - Description xml service started.... 2018-09-19 17:16:42,423 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - UPNP Discovery Listener starting.... 2018-09-19 17:16:42,423 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Interface: bond0 matches upnp config address of IP address: /192.168.1.10 2018-09-19 17:16:42,423 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: Adding bond0 to our upnp join interface set. 2018-09-19 17:16:42,423 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - UPNP Discovery Listener running and ready.... 2018-09-19 17:17:04,813 [qtp1559522452-12] INFO com.bwssystems.HABridge.hue.HueMulator - Traceupnp: hue api user create requested for device type: test_ha_bridge#192.168.11.7 and username: 297c026261524d4993801d10f9463908 2018-09-19 17:17:28,809 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: SSDP M-SEARCH packet from 192.168.1.10:1054 2018-09-19 17:17:29,010 [main] INFO com.bwssystems.HABridge.upnp.UpnpListener - Traceupnp: send upnp discovery template 1 with response address: 192.168.1.10:8008 to address: /192.168.1.10:1054

sijones commented 6 years ago

I found clearing all devices in Alexa and then a upnp delay of 250 worked perfect.

whatsalinux commented 6 years ago

Gave that a shot, sadly no change. It found only the ecobee device.
Does offer some hope if other people have habridge still working.

sijones commented 6 years ago

If you have other upnp devices, try turning them off while you do the discovery. I've got a feeling Amazon's implementation isn't great so multiple machines answering the request may throw it out. Certainly when i had 2 ha-bridges running the echo wouldn't find either.

whatsalinux commented 6 years ago

Ok I got it - some multicast or UPNP issue present between my wifi network and my ethernet network subnets that wasn't a problem historically, seems to be now. I set up a raspi hosting a habridge jar on my wifi net, and alexa found habridge fine.

glad to have it working again! thanks for the help!