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 198 forks source link

Alexa will not discover HABridge #1184

Closed Mooose1 closed 3 years ago

Mooose1 commented 4 years ago

I have a new setup, HomeGenie and HA-Bridge on a RaspPI-3. I have 2 lights configured on HG and the Bridge and they control the lights manually. I have an Amazon Echo Dot ver 3 and an Echo Show. I cannot get Alexa to discover the new devices. I do not have an older version to test if that is my problem. Any suggestions?

bwssytems commented 4 years ago

Please turn on trace upnp in the control tab and post your log after a discovery. Have you looked at the wiki on this? https://github.com/bwssytems/ha-bridge/wiki/Trouble-Shooting#q-echo-does-not-discover-my-ha-bridge

Mooose1 commented 4 years ago

I enabled Trace upnp, it is configure on the router and I am using port 80. Attached are 2 logs. IGMP snooping is not enabled. HABridge5.docx HABridge6.docx

bwssytems commented 4 years ago

I cant read your files as they are cut out. Could you just send a text file of the syslog messages so I can see the whole message please. Also, please identify the ip address of your Alexa

Mooose1 commented 4 years ago

Alexa dot is 192.168.0.136

HABridge6.txt HABridge5.txt

bwssytems commented 4 years ago

Those files are empty. You need to go to the syslog file in /var/log and take the relevant snippit in a text editor not ms word

Mooose1 commented 4 years ago

Try this... 03-08-2020 10:24:18.252 INFO HomeGenie Home created. com.bwssystems.HABridge.plugins.homegenie.HomeGenieHome 03-08-2020 10:24:18.260 INFO HABridge device management service started.... com.bwssystems.HABridge.devicemanagmeent.DeviceResource 03-08-2020 10:24:18.273 INFO Hue emulator service started.... com.bwssystems.HABridge.hue.HueMulator 03-08-2020 10:24:18.283 INFO Traceupnp: upnp config address: 192.168.0.58 -useIface: false on web server: 0.0.0.0:80 com.bwssystems.HABridge.HABridge 03-08-2020 10:24:18.284 INFO Description xml service started.... com.bwssystems.HABridge.upnp.UpnpSettingsResource 03-08-2020 10:24:18.288 INFO UPNP Discovery Listener starting.... com.bwssystems.HABridge.upnp.UpnpListener 03-08-2020 10:24:18.290 INFO Traceupnp: Interface: wlan0 valid usable IP address: /192.168.0.58 com.bwssystems.HABridge.upnp.UpnpListener 03-08-2020 10:24:18.290 INFO Traceupnp: Adding wlan0 to our upnp join interface set. com.bwssystems.HABridge.upnp.UpnpListener 03-08-2020 10:24:18.291 INFO Traceupnp: Interface: lo valid usable IP address: /127.0.0.1 com.bwssystems.HABridge.upnp.UpnpListener 03-08-2020 10:24:18.292 INFO Traceupnp: Adding lo to our upnp join interface set. com.bwssystems.HABridge.upnp.UpnpListener 03-08-2020 10:24:18.292 INFO Create and run mDNS service. com.bwssystems.HABridge.upnp.UpnpListener 03-08-2020 10:24:18.302 INFO UPNP Discovery Listener running and ready.... com.bwssystems.HABridge.upnp.UpnpListener 03-08-2020 10:24:18.878 INFO Traceupnp: request of description.xml from: 192.168.0.136:80 filled in with address: 192.168.0.58:80 com.bwssystems.HABridge.upnp.UpnpSettingsResource 03-08-2020 10:24:38.972 INFO Traceupnp: sendUpnpNotify notifyTemplate1 com.bwssystems.HABridge.upnp.UpnpListener 03-08-2020 10:24:39.623 INFO Traceupnp: sendUpnpNotify notifyTemplate2 com.bwssystems.HABridge.upnp.UpnpListener 03-08-2020 10:24:40.275 INFO Traceupnp: sendUpnpNotify notifyTemplate3 com.bwssystems.HABridge.upnp.UpnpListener 03-08-2020 10:24:42.330 INFO The requested route [/api//lights/100/state] has not been mapped in Spark for Accept: [application/json, text/plain, /] spark.http.matching.MatcherFilter 03-08-2020 10:24:42.388 INFO Traceupnp: hue api user create requested for device type: test_ha_bridge#192.168.0.136 and username: 359feaa5553547d3b4ab541dd60b9612 com.bwssystems.HABridge.hue.HueMulator 03-08-2020 10:24:48.391 INFO Tracestate: hue state change requested: 359feaa5553547d3b4ab541dd60b9612 from 192.168.0.136 body: {"on":true} com.bwssystems.HABridge.hue.HueMulator 03-08-2020 10:24:48.422 INFO Tracestate: Calling on-off as requested: true com.bwssystems.HABridge.hue.HueMulator 03-08-2020 10:24:48.423 INFO Tracestate: Decode Json for url items: [{"item":"http://192.168.0.58:8080/api/HomeAutomation.X10/A1/Control.On","type":"httpDevice","contentType":"text/html","httpVerb":"GET"}] com.bwssystems.HABridge.hue.HueMulator 03-08-2020 10:24:48.425 INFO Tracestate: Calling Home device handler for type : httpDevice com.bwssystems.HABridge.hue.HueMulator 03-08-2020 10:24:51.702 INFO Tracestate: hue state change requested: 359feaa5553547d3b4ab541dd60b9612 from 192.168.0.136 body: {"on":false} com.bwssystems.HABridge.hue.HueMulator 03-08-2020 10:24:51.705 INFO Tracestate: Calling on-off as requested: false com.bwssystems.HABridge.hue.HueMulator 03-08-2020 10:24:51.705 INFO Tracestate: Decode Json for url items: [{"item":"http://192.168.0.58:8080/api/HomeAutomation.X10/A1/Control.Off","type":"httpDevice","contentType":"text/html","httpVerb":"GET"}] com.bwssystems.HABridge.hue.HueMulator 03-08-2020 10:24:51.707 INFO Tracestate: Calling Home device handler for type : httpDevice com.bwssystems.HABridge.hue.HueMulator

Mooose1 commented 4 years ago

Please let me know if this works. I hit the link button twice during discovery. HABridge8.txt

szmyko commented 4 years ago

Problem disappeared after adding "return" command in AddressUtil.java for this line: getOutboundAddress(new InetSocketAddress(remoteAddress, remotePort)); --> return getOutboundAddress(new InetSocketAddress(remoteAddress, remotePort));

Mooose1 commented 4 years ago

Can you give me some guidance how to correct this issue?

szmyko commented 4 years ago

Fixed ha-bridge.jar: ha-bridge.zip

fauna5 commented 4 years ago

I just had to update to this version from v5.3.0 to get Alexa gen 1 discovering devices again. Thanks for the fix 👍

Nachtfalke49 commented 4 years ago

With Echo Dot 2 and 3 it does not work with the new ha-bridge.jar.

PPenglis commented 4 years ago

Mar 18 22:25:50 hobbs java[692]: 2020-03-18 22:25:50,662 [qtp11501746-14] INFO com.bwssystems.HABridge.hue.HueMulator - Traceupnp: hue api user create requested: {"devicetype": "Echo"} from address: 192.168.0.112 Mar 18 22:25:50 hobbs java[692]: 2020-03-18 22:25:50,667 [qtp11501746-14] INFO com.bwssystems.HABridge.hue.HueMulator - Traceupnp: hue api user create requested for device type: Echo#192.168.0.112 and username: dedd81ce9d6b462e9be5610ef8fbb9ea Mar 18 22:25:50 hobbs java[692]: 2020-03-18 22:25:50,722 [qtp11501746-15] INFO com.bwssystems.HABridge.hue.HueMulator - Traceupnp: hue lights list requested by user: dedd81ce9d6b462e9be5610ef8fbb9ea from address: 192.168.0.112 Mar 18 22:25:50 hobbs java[692]: 2020-03-18 22:25:50,750 [qtp11501746-15] ERROR spark.http.matching.GeneralError - Mar 18 22:25:50 hobbs java[692]: java.lang.NullPointerException: null Mar 18 22:25:50 hobbs java[692]: #011at com.bwssystems.HABridge.plugins.hue.HueHome.getHueDeviceInfo(HueHome.java:88) Mar 18 22:25:50 hobbs java[692]: #011at com.bwssystems.HABridge.hue.HueMulator.lightsListHandler(HueMulator.java:930) Mar 18 22:25:50 hobbs java[692]: #011at com.bwssystems.HABridge.hue.HueMulator.lambda$setupServer$23(HueMulator.java:304) Mar 18 22:25:50 hobbs java[692]: #011at spark.ResponseTransformerRouteImpl$1.handle(ResponseTransformerRouteImpl.java:47) Mar 18 22:25:50 hobbs java[692]: #011at spark.http.matching.Routes.execute(Routes.java:61) Mar 18 22:25:50 hobbs java[692]: #011at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:130) Mar 18 22:25:50 hobbs java[692]: #011at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50) Mar 18 22:25:50 hobbs java[692]: #011at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1568) Mar 18 22:25:50 hobbs java[692]: #011at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) Mar 18 22:25:50 hobbs java[692]: #011at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) Mar 18 22:25:50 hobbs java[692]: #011at org.eclipse.jetty.server.Server.handle(Server.java:530) Mar 18 22:25:50 hobbs java[692]: #011at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347) Mar 18 22:25:50 hobbs java[692]: #011at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256) Mar 18 22:25:50 hobbs java[692]: #011at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) Mar 18 22:25:50 hobbs java[692]: #011at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) Mar 18 22:25:50 hobbs java[692]: #011at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) Mar 18 22:25:50 hobbs java[692]: #011at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247) Mar 18 22:25:50 hobbs java[692]: #011at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140) Mar 18 22:25:50 hobbs java[692]: #011at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) Mar 18 22:25:50 hobbs java[692]: #011at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382) Mar 18 22:25:50 hobbs java[692]: #011at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708) Mar 18 22:25:50 hobbs java[692]: #011at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626) Mar 18 22:25:50 hobbs java[692]: #011at java.base/java.lang.Thread.run(Thread.java:834)

PPenglis commented 4 years ago

Sorry i thought I posted the reply: I did some debugging and realised the crashed line was that the habridge couldn't find the Hub info. The name for the hub has to match exactly what the hub is called along with the IP address and mine differed slightly. Fixing this i now have a functioning system with Alex Echo Plus 2 connecting.

Mooose1 commented 4 years ago

gooterz, can you elaborate a little? Where did you find the names not matching? And, which port are you using, 80 or 81?

heikoh81 commented 4 years ago

Same problem here, with HABridge 5.2.0, 5.3.0, 5.3.0a (tried all versions). Problem started yesterday, Echo not working properly any more. On Web-Interface, noticed the double amount of devices, so started deleting and rediscovering. Yesterday, it worked after several tries, now it it not working any more. After pluggin in my Echo Flex that normally is not used, it started discovering again, but not all my 136 devices.

Also tried to enable Belkin Emulation on one of my Tasmota Plugs -> instant discovery.

They probably changed something AGAIN, and now discovery fails AGAIN.

I have 3 Echo Dot 2nd Gen, 1 Echo Show 1st Gen, 3 Echo 2nd Gen, 1 Echo Flex.

PPenglis commented 4 years ago

Mooose1, In the hue app you can go into settings and switch devices. You should see one for the ha bridge and one for the real hue hub. For me that name had to match the one in the ha bridge, in the bridge settings for the hue bridge.

Mooose1 commented 4 years ago

I do not have a hue hub. Should I? :-)

Mooose1 commented 4 years ago

I now have a gen 1 echo. I reinstalled the ha-bridge.jar file version 5.3.0 and Alexa still will not discover any new devices.

bwssytems commented 4 years ago

@szmyko I have fixed the AddressUtils.getOutboundAddress issue in the dev branch

Mooose1 commented 4 years ago

So, I just have to reinstall Ha-bridge for the fix?

bwssytems commented 4 years ago

For all: The new Release Candidate is out for testing.... https://github.com/bwssytems/ha-bridge/releases/tag/v5.3.1RC1

Please post your issues or successes at #1192

slottedpig commented 3 years ago

Has anyone had any success with this, using the RC5 .jar or 5.2.1 or any version in between i cant find any new devices.

chrischn82 commented 3 years ago

i´m firm with this problem, too. These days my echo dot 2 won´t discover my habridge devices. I figured out that the real hue bridge devices uniqueid-design differ from the habridge. example: Phillips Hue Bridge Device: "12":{ "state":{"on":true,"alert":"select","mode":"homeautomation","reachable":true}, "swupdate":{"state":"notupdatable","lastinstall":"2021-07-17T18:14:15"}, "type":"On/Off plug-in unit", "name":"Computer", "modelid":"Plug 01", "manufacturername":"OSRAM", "productname":"On/Off plug", "capabilities":{"certified":false,"control":{}, "streaming":{"renderer":false,"proxy":false}}, "config":{"archetype":"plug","function":"functional","direction":"omnidirectional"}, **"uniqueid":"7c:b0:3e:aa:0a:0a:b6:71-03",** "swversion":"V1.05.09"},

HA Bridge Device: {"id":"100", **"uniqueid":"f8:99:13:9d:f5:e1:05-05",** "name":"pisse","mapId":"12345", "mapType":"httpDevice", "deviceType":"switch", "inactive":false, "noState":false, "offState":false, "description":"pissgeraet", "comments":"", "deviceState":{"on":false,"bri":0,"alert":"none","reachable":true}, "onFirstDim":false, "onWhenDimPresent":false, "lockDeviceId":false, "dimNoOn":false, "dimOnColor":false},

the REAL devices have 1 hex-Block more ( instead 7+1, the have 8+1 )

I just added one block in the device.db and voila !! First time "alexa, find that fuckin devices!" .... "I found 136 new devices, just say turn on self-destruction" ....

maybe that helps someone else, too ...

better would be to edit the part wich creates the unique-id´s. But i didnt find in the jar-archive

kepps2113 commented 1 year ago

I just added one block in the device.db and voila !!

THANK YOU! This solved my issue as well. I was updating to a new raspberry pi and decided to do a clean install, but used the old DB backup. I couldn't get anything to work until I found your comment.

hradec commented 1 year ago

"Fudge" me!! That fixed it for me too!! Thank you so much!

I'm using the latest and greatest version of ha-bridge, changing the unique id of my first added device (100 as well) from f8:99:13:9d:f5:e1:05-05 to f8:99:13:9d:f5:e1:05:01-05 in devices.db file made alexa finally found the device.

On the latest alexa app version, I added it by selecting device + button->Philips hue->"NO"->Philips Hue V1 bridge->Discover Devices

Without the extra :01 in the device, It wouldn't detect anything!

Thanks a lot!!