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

Hub not responding #466

Closed rhalbheer closed 7 years ago

rhalbheer commented 7 years ago

Hi All, I love the software (but I am still fighting with the uniqueness of the names). I have one issue though: From time to time Alexa tells me that the hub does not respond. Rebooting the rPi or do a "Bridge Reinitialize" will help to make it responsive again. Scheduled re-start would be help but I would rather know, why this is happening. Any idea? Thank you Roger

audiofreak9 commented 7 years ago

@rhalbheer It would help to know what are you running the hub on?

jbardi commented 7 years ago

I've been using ha-bridge since near the beginning, and never had a problem with responses from Alexa until today. I've been running 4.1.4 since it came out over a week ago, and never had a problem until now. I just started getting Alexa telling me that my devices were not responding, and it couldn't turn anything on or off. After reinitializing or restarting ha-bridge, everything immediately started working again. Very strange. No changes from my setup for months, with the only change being the upgrading to 4.1.4 8 days ago.

I didn't think to check the log before restarting habridge, so if this happens again, I'll be sure to check the logs to see if there is anything in there before I clear it out with a restart.

Although, I can not rule out a problem with Alexa and my internet connection. I have 1 Echo and 4 Echo Dots, and earlier today, before I noticed that the habridge devices were not accessable, I asked one of the Echo Dots for the time, and it responded "something went wrong", and then I asked the fullsize Echo for the weather, and it responded with the same "something went wrong". So I may very well have been having internet/router issues, which could have caused my Alexa devices to become unpaired with habridge, and timed out reconnecting. Thus a restart of habridge could have triggered the Alexa devcies to reconnect.

So what appeared to me as a problem with habridge, could have simply been a temporary issue with my internet/router.

Have you had any other internet related hiccups during the same time that you can remember? Just a thought.

rhalbheer commented 7 years ago

@audiofreak9 : Fair point, sorry. I am running the latest version (4.1.4) on a "plain vanilla" Raspberry Pi.

bwssytems commented 7 years ago

yes, please check the logs for any exceptions.

rhalbheer commented 7 years ago

sorry but where do I find the logs - I have a standard installation

rhalbheer commented 7 years ago

found it. I was unaware that you log to "normal" syslog I will try to investigate

bwssytems commented 7 years ago

Please post that exception please as some others are having an issue as well

rhalbheer commented 7 years ago

I will as soon as it happens again. The current log seems to be fairly clean (with the exception of some "bad HTTP parsed" which I do not understand, where it could be coming from

yevhendjus commented 7 years ago

I have a similar issue, my HA-bridge works for a minute or two and then it does not work. My google home is registering my commands and says its performing them, but nothing happens. When I test on and test off devices, they too do not work until I reinitialize the bridge and then everything starts working again for a minute or two. Repeat.

Any help or advice?

audiofreak9 commented 7 years ago

Please post log as requested by @bwssystems above.

jbardi commented 7 years ago

Ok, there is definately a problem with habridge 4.1.4, or more specifically, there seems to be a problem with the com.bwssystems.HABridge.plugins.http.HTTPHome component

It is apparently freezing when I issue a request from Alexa and she says the device is not responding, because I then quickly load up the interface and check the log and there will be 1 warning, logged at the exact moment I had issued the most recent request, and then I know the HTTP plugin component is locked up because testing with the on and off buttons in habridge on any of the HTTP devices results in nothing. No message, no error and no action, and continued attempts of issuing commands with Alexa results in the echo responding with either "Device is not responding" or "Something went wrong" and no further warnings in the logs beyond that first one that caused it to freeze. But, if I test the on or off in habridge for one of my "exec" devices (ones that do not make an http call but rather run a terminal script), or issue a command for that device with Alexa, they still run and the habridge interface popups up a green popup saying it was successfully executed.

The warning is not always occurring on the same device, however, it only freezes on devices of type HTTP, so the problem appears to be with the com.bwssystems.HABridge.plugins.http.HTTPHome component.

I have been using habridge for a while now, and everthing was stable up to 4.1.3, so these issues only started with 4.1.4

I have now had to restart it a dozen times in the past 24 hours. The time between freezes is random. Sometimes 20 minutes, sometimes several hours. Here is an example of a one line warning I get before activity ceases and the HTTP plugin stops working:

Feb 14 18:26:25 Home-Assistant java[11471]: 2017-02-14 18:26:25,143 [qtp698930-23] WARN com.bwssystems.HABridge.plugins.http.HTTPHome - Error on calling url to change device state: http://192.168.1.94:8123/api/services/input_boolean/turn_off

yevhendjus commented 7 years ago

So, I'm thinking this has to do with the connection to HomeAssistant for me because when I reinitialize HABridge and go to the Home Assistant Tab I can see all the available home assistant entities (at this point I can test using the buttons and use Google Home to control my configured devices on HABridge. However after a few minutes when I refresh the Home Assistant tab they all seem to disappear. Makes me think that HABridge looses connection to HomeAssistant somehow after a minute or so. See images below not sure which log you guys want me to post. from the logs tab ? doesn't seem like theres anything exciting there.

screen shot 2017-02-14 at 8 37 39 pm screen shot 2017-02-14 at 8 36 37 pm
jbardi commented 7 years ago

yevhendjus, your problem is definitely different as you seem to be only using the Home Assistant feature of habridge, with only 4 devices. I think that it is most likely a separate issue than the one rhalbheer and myself are experiencing.

I have 52 devices, and 90% of them are HTTP devices, I receive a warning in the log, but only ever a single warning, always referencing an HTTP device, while all of my other device types, such as exec type still work fine from Alexa as well as the interface.

My problem is definately with the com.bwssystems.HABridge.plugins.http.HTTPHome plugin component.

Its hard for me to provide anything else, as I only ever get that 1 warning message in the log and then there is no further ability to even attempt to turn on any HTTP devices, and the log shows nothing else to help in figuring out the problem.

I restart, everyting works perfectly for between 20 minutes and a few hours, turning devices on and off, and then out of the blue, I issue a command, Alexa tells me the device is not responding and the HTTP plugin component stops working until I restart again.

I will downgrade to 4.1.3, that way if it continues to run stable, without any further issues, we will know it has to do with the HTTP component in 4.1.4

yevhendjus commented 7 years ago

haha 52 devices, oh boy thats much more problematic. Anyways if someone can think of whats my problem please let me know

jbardi commented 7 years ago

The more I think about it, your problem could very well be related to the HTTP component as well, at least somewhere in the backend workings of habridge, as the Home Assistant feature of habridge still issues HTTP requests to the Home Assitant API to actually interact with the devices, so I'm sure there is a chance that even the Home Assistant feature is using the HTTP plugin component in the backend.

jbardi commented 7 years ago

yevhendjus, I added my home assistant info under Bridge Control to test it out, and sure enough, Home Assistant devices are also causing it to stop responding with the following warning message in the log:

"Error calling out to HA gateway: IOException in log", only this one is happening in the following component: com.bwssystems.HABridge.plugins.http.HTTPHandler, so I have to assume that this is the problem you are experiencing, which seems part of the same core issue that is causing my problem.

So, both the com.bwssystems.HABridge.plugins.http.HTTPHome component and the com.bwssystems.HABridge.plugins.http.HTTPHandler component are causing the exact same unresponsive issue that is occurring at random times. In fact, as of tonight, its been happening constantly. I've had to restart habridge at least 15 times in the past 4 hours.

The interesting thing is, I downgraded to 4.1.3 and it is still happening, so I have no idea what is going on, but there is definitely an issue with making HTTP calls, either directly through the HTTP type device as well as through the HA Bridge type device. After a restart, things seems to run fine for a while (15 min, 20 min, 1 hour, etc... random). I can make all the HTTP calls I want, and they all work, and then suddenly, whamo... I get a warning in the log, Alexa tells me the device is not responding and that is all she wrote. Another restart is required to regain control. In fact, it just went out as I am writing this... this time it only took less than 10 minutes since my last restart.

Now, all of my HTTP devices are actually calls to the Home Assistant API, its just that I am still making them as direct calls rather than using the Home Assistant built-in helper, because I have so many devices and I just didn't want to go through and switch them over to using the Home Assistant Helper when it was made available in the 4.0.0 release. So I can't say as to whether or not this is happening with ALL HTTP calls, or just HTTP calls related to Home Assistant, but either way, habridge is unusable for me at the moment.

And just in case any was wondering, when habridge is unresponsive, Home Assitant itself, including its API are still working fine. I can control my house with the Home Assistant web interface as well as through physical Z-wave scene controls I have setup in each room, so Home Assistant is responding to all calls and continuing to automate my house with its scripts and sensors, etc via its API, its just that habridge stops being able to make any HTTP calls once it gets one of those 2 warnings.

rhalbheer commented 7 years ago

It is really strange. Since I logged the question it works. I did not touch it, not reboot it, nothing. It just works (so far). I have about 15 devices connected with it. So, as soon as it fails again, I will check the log but in the meantime I just have to wait or is there a way to find the last log entry before the last reboot? Sorry, I am fairly profound on Windows but still struggling sometimes with Linux :-(

scottdalton commented 7 years ago

I also started experiencing this problem within the last day or so.
It seems like something changed in Home Assistant 0.38x that is causing it to lock up as previously HA-Bridge had been quite stable.

I'm using a combination of the newer built in Home Assistant helper and HTTP Post calls.

jbardi commented 7 years ago

I'm still running Home Assistant 0.37.1 so it is not a 0.38 issue, not is my Home Assistant having issues at all. I have full control over Home Assistant through all means other than habridge, so Home Assistant is not having issues for me.

jbardi commented 7 years ago

What used to happen intermittently is now occurring within a few minutes of a restart. I can get habridge to issue 1 or 2 commands successfully before it freezes up. So I can't even use it at all anymore. May have to look for an alternative to habridge.

bwssytems commented 7 years ago

@jbardi When you get that IOException in the log, I need to see all of the details of it, including the stack trace. I need more info please.

bwssytems commented 7 years ago

@jbardi Could you also send me your device.db too please.

joshburgess79 commented 7 years ago

I am having the same problem, although I just switched from Homegenie to HomeAssistant, and I also upgraded to the newest version of habridge. I never had a problem on homegenie, or ha-bridge-3.5.1. I have set the logging to Trace, and when it happens again I'll get you a copy of the logs right away.

joshburgess79 commented 7 years ago

@bwssystems

So the issue just reoccurred. I am on the newest version of Ha-bridge. My switches still work through the Home assistant webpage. There are three GE light switches and one GE recepticle. I am running homeassistant and habridge on the same rpi 2 running raspbian, and my zwave dongle is an Aeon Labs z-stick 2. Let me know if you need more info. Here is the pastebin http://pastebin.com/Q55AHgeA

papa-legba commented 7 years ago

Same situation with bridge loosing connection with home assistant a few minutes after boot or re-initialization.

Currently on a clean install of hassbian ha 38.3 and ha bridge 4.14. On raspberry pi 2.

Issue first started when upgrading to hass 38.1. Downgrading back to 37.1 didn't resolve. Then downgrading habridge to 4.14 didn't resolve. Then I thought a clean install of hassbian would work but still no go..

Habridge communicates fine with my real hue bridge and lights. And during the initial boot period of the bridge also worked with all the home assistant variations above but after a few minutes the error

02-18-2017 22:24:33.350 WARN Cannot get an devices for HomeAssistant HAAS http call failed. com.bwssystems.HABridge.plugins.hass.HomeAssistant 02-18-2017 22:24:33.351 WARN Cannot get devices for HomeAssistant with name: HAAS, skipping this Hass. com.bwssystems.HABridge.plugins.hass.HassHome

jbardi commented 7 years ago

Sorry for not getting back with you on this issue. I am unable to provide logs because due to the instability of habridge for like 4 days, I couldn't wait any longer, and what with the Missus breathing down my neck about her not being able to control the house, well, I was forced to revert to the direct built-in Hue Bridge Emulation inside Home Assistant, so I am not currently running habridge to be able to output any logs.

I mean I could try it on another Raspberry Pi, but as it does not have the exact same software installed or the same setup, especially since Home Assitant is running on the same Pi as habridge was, so if I run habridge on a different Pi than Home Assitant, it's possible it may not even occur over there. Besides the fact that I would have duplicate device names on the same network being picked up by all 5 of the Alexa devices, it could turn into a right cluster, if you know what I mean.

There is definitely not a problem for me with Home Assistant, especially since I was running 37.1, unlike the others that had upgraded to 38.x, but something is wrong in the combination of Home Assistant and habridge without a doubt, because there are just too many people having similar problems as of late, so I really hope it gets resolved, unfortunately, I feel like a complete a** for not being able to contribute more to the resolution due to my circumstances, but I am sure it will be figured out eventually, because I am taking a hit with limited capabilites by using the built-in Hue Emulation features of Home Assitant compared with all the features I am losing out on by not using habridge, so I have a definite interest in seeing this resolved.

bwssytems commented 7 years ago

@joshburgess79 I do not see any errors in your log. Turn off upnp trace as that is just cluttering up the log.

@papa-legba Looks like it lost its brains there. I would like to see your log file with the exception in it when you get a chance.

@jbardi Can't do much unless I see a log.

papa-legba commented 7 years ago

I messaged you the log. Please let me know if you need more detail. Never submitted a log prior so specifics would be helpful. Thanks again

djrej commented 7 years ago

I have the same problem, after I upgraded Home Assistant to 0.38.

as a work around I created a cronjob to restart HAbridge. (I don't know the java script to reinitialize the bridge)

I also think restarting HA-Bridge is faster than re-initializing the bridge.

joshburgess79 commented 7 years ago

I'm now inclined to believe it is a problem with HASS. I switched back to homegenie and have not had a problem with HaBridge at all since then.

On Mon, Feb 20, 2017 at 12:48 PM, djrej notifications@github.com wrote:

I have the same problem, after I upgraded Home Assistant to 0.38.

as a work around I created a cronjob to restart HAbridge. (I don't know the java script to reinitialize the bridge)

I also think restarting HA-Bridge is faster than re-initializing the bridge.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bwssytems/ha-bridge/issues/466#issuecomment-281155361, or mute the thread https://github.com/notifications/unsubscribe-auth/AS6XNzObhHQiJU3t-vrVxlWNFtYhcngNks5red_3gaJpZM4L_Zhi .

papa-legba commented 7 years ago

@djrej What did your chronjob look like. Sorry... Noob question

djrej commented 7 years ago

@papa-legba

5/ * ~/path/(Your Script.sh)

It restarts every 5min

I created a Bash Script

!#/bin/bash sudo systemctl restart (HA Bridge service)

papa-legba commented 7 years ago

@djrej got the cronjob working. Thanks.

djrej commented 7 years ago

@papa-legba no problem.

I don't time to analyze the logs yet. when I get a free time I'll try figuring the problem as well.

bwssytems commented 7 years ago

I am testing with an old version of HASS 0.32.2, guess I'll need to upgrade

bwssytems commented 7 years ago

Also, with 4.1.4 and 0.32.2 it works without issue.

bwssytems commented 7 years ago

confirmed, new version is different will need to fix

bwssytems commented 7 years ago

One thing I just noticed with 0.38.4 is that it takes forever for it to start listening on port 8123

bwssytems commented 7 years ago

And now I have got it to fail. Looking into this.

bwssytems commented 7 years ago

Looks like HomeAssistant is timing out on calls and returns a 504 error back to the ha-bridge, which was not being handled properly. Fixed in the next release.

yevhendjus commented 7 years ago

Awesome! Thanks! Any estimate for when that will be?

On Wed, Feb 22, 2017 at 3:56 PM BWS Systems notifications@github.com wrote:

Looks like HomeAssistant is timing out on calls and returns a 504 error back to the ha-bridge, which was not being handled properly. Fixed in the next release.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bwssytems/ha-bridge/issues/466#issuecomment-281801063, or mute the thread https://github.com/notifications/unsubscribe-auth/AScx2SKQpa653uv1MHpZLQKMVRtAwRhiks5rfKECgaJpZM4L_Zhi .

bwssytems commented 7 years ago

Soon... Imminent.... Fixing the bulk add then most likely will update

scottdalton commented 7 years ago

Thanks for the update! Nice to have the bridge back in action.

papa-legba commented 7 years ago

Yes, thanks!!!