nguyer / homeassistant-bond-home

38 stars 15 forks source link

Bond stops communicating with Home Assistant after 12 hours #32

Closed Go0oSer closed 4 years ago

Go0oSer commented 4 years ago

I recently configured my Bond Home for local control. It works great, but my Bond home is disconnected from my Home Assistant after about 12 hours.

Rebooting HA typically resolves the issue, but it is consistent. After 12 hours - the Bond hub doesnt respond to my HA commands.

Ive also seen this reported in the HA forums.

The error message in the HA log is - 2020-07-08 10:17:10 WARNING (MainThread) [homeassistant.components.fan] Updating bond fan took longer than the scheduled update interval 0:00:30

niemyjski commented 4 years ago

Can you ping/curl the bond from ha?

Sent from my iPhone

On Jul 8, 2020, at 9:18 AM, Go0oSer notifications@github.com wrote:

 I recently configured my Bond Home for local control. It works great, but my Bond home is disconnected from my Home Assistant after about 12 hours.

Rebooting HA typically resolves the issue, but it is consistent. After 12 hours - the Bond hub doesnt respond to my HA commands.

Ive also seen this reported in the HA forums.

The error message in the HA log is - 2020-07-08 10:17:10 WARNING (MainThread) [homeassistant.components.fan] Updating bond fan took longer than the scheduled update interval 0:00:30

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Go0oSer commented 4 years ago

I am able to do both.

docker exec -it home-assistant /bin/bash bash-5.0# ping 192.168.99.75 PING 192.168.99.75 (192.168.99.75): 56 data bytes 64 bytes from 192.168.99.75: seq=0 ttl=254 time=4.849 ms 64 bytes from 192.168.99.75: seq=1 ttl=254 time=5.790 ms 64 bytes from 192.168.99.75: seq=2 ttl=254 time=5.565 ms 64 bytes from 192.168.99.75: seq=3 ttl=254 time=8.042 ms 64 bytes from 192.168.99.75: seq=4 ttl=254 time=7.843 ms 64 bytes from 192.168.99.75: seq=5 ttl=254 time=3.391 ms 64 bytes from 192.168.99.75: seq=6 ttl=254 time=9.372 ms 64 bytes from 192.168.99.75: seq=7 ttl=254 time=3.368 ms ^C --- 192.168.99.75 ping statistics --- 8 packets transmitted, 8 packets received, 0% packet loss round-trip min/avg/max = 3.368/6.027/9.372 ms bash-5.0# curl -i http://192.168.99.75/v2/sys/version HTTP/1.1 200 OK Content-Length: 225 Content-Type: application/json; charset=utf-8

{"target":"zermatt","fw_ver":"v2.10.21","fw_date":"Wed Feb 19 15:31:13 UTC 2020","uptime_s":6379,"make":"Test Brand","model":"Model","branding_profile":"TEST","bondid":"REDACTED","upgradehttp":true,"api":2,"":"506a3ca3"}

niemyjski commented 4 years ago

That's really odd, I'd try that once it stops working and also enable greater log level in ha until this is resolved. I wonder what we are setting for a timeout on our library.

Go0oSer commented 4 years ago

FYI - It is currently in "Broken" state and those tests were run with it broken.

On Wed, Jul 8, 2020 at 10:49 AM Blake Niemyjski notifications@github.com wrote:

That's really odd, I'd try that once it stops working and also enable greater log level in ha until this is resolved. I wonder what we are setting for a timeout on our library.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nguyer/homeassistant-bond-home/issues/32#issuecomment-655567179, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOIDP5RTQIF4XKL43PBIEHDR2SBOBANCNFSM4OUT3HQA .

niemyjski commented 4 years ago

No idea then, maybe increase the logging and see if something is hanging it up? I'm not seeing this on mine. What version of HA do you have?

Go0oSer commented 4 years ago

Currently running the latest stable 0.112.3.

I have the debug logging enabled. Ill come back with anything I find. Thanks for the fast responses.

ViolentPoo commented 4 years ago

Try reserving your Bond with a static IP address in your router, also check in your router to make sure it is not releasing the ip address after 12 hours. Also what firmware is your bond running?

Go0oSer commented 4 years ago

Although I am using DHCP, I am pretty certain the IP for the device is not changing. Nevertheless, I set up a reservation outside of my DHCP range anyway. Cant hurt.

Bond firmware is listed as the latest in the Bond app - 2.10.21

geekofweek commented 4 years ago

Same behavior. I setup a ping sensor to the Bond hub when it started and I'm not loosing connectivity. Oddly enough the light component still functions, it's only the fan that losses connectivity after around 12 hours. Bond is still able to control the device. The bond hub has a DHCP reserved IP and hostname associated with it so I do not believe that is the issue.

geekofweek commented 4 years ago

FYI: Setting custom_components.bond: debug doesn't seem to provide any data

Go0oSer commented 4 years ago

Im seeing the same behavior - no data after enabling debug logging in my config.yaml.

geekofweek commented 4 years ago

Only thing I'm seeing, with logging up as verbose as I can get it, when it fails:

2020-07-09 03:03:47 WARNING (MainThread) [homeassistant.components.fan] Updating bond fan took longer than the scheduled update interval 0:00:30
2020-07-09 03:03:50 ERROR (MainThread) [homeassistant.helpers.entity] Update for fan.living_room_east fails
  File "/config/custom_components/bond/fan.py", line 129, in update
2020-07-09 03:03:47 WARNING (MainThread) [homeassistant.components.fan] Updating bond fan took longer than the scheduled update interval 0:00:30
  File "/config/custom_components/bond/light.py", line 108, in update
    bondState = self._bond.getDeviceState(self._deviceId)
  File "/usr/local/lib/python3.7/site-packages/bond/bond.py", line 157, in getDeviceState
  File "/config/custom_components/bond/fan.py", line 129, in update
Go0oSer commented 4 years ago

I have yet to have a failure since implementing some of the suggestions listed here. It has been over 12 hours since I have lost connection between Bond and HA.

On Thu, Jul 9, 2020 at 9:26 AM geekofweek notifications@github.com wrote:

Only thing I'm seeing, with logging up as verbose as I can get it, when it fails:

2020-07-09 03:03:47 WARNING (MainThread) [homeassistant.components.fan] Updating bond fan took longer than the scheduled update interval 0:00:30 2020-07-09 03:03:50 ERROR (MainThread) [homeassistant.helpers.entity] Update for fan.living_room_east fails File "/config/custom_components/bond/fan.py", line 129, in update

2020-07-09 03:03:47 WARNING (MainThread) [homeassistant.components.fan] Updating bond fan took longer than the scheduled update interval 0:00:30 File "/config/custom_components/bond/light.py", line 108, in update bondState = self._bond.getDeviceState(self._deviceId) File "/usr/local/lib/python3.7/site-packages/bond/bond.py", line 157, in getDeviceState File "/config/custom_components/bond/fan.py", line 129, in update

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nguyer/homeassistant-bond-home/issues/32#issuecomment-656126098, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOIDP5TBD5IHVT5ZPZ47FATR2XAO7ANCNFSM4OUT3HQA .

Go0oSer commented 4 years ago

Also I have my Bond home on a different network segment than the HA server. Initially I didnt poke a hole in the firewall for the bond to talk to HA. But after having this issue, I did allow the Bond IP to talk bidirectionally with HA.

niemyjski commented 4 years ago

I have them on the same IoT network but with a static ip and I've never seen this (but I believe you are seeing this). @geekofweek have you ever had issues with any of your other devices? We could add a timeout parameter to the base library and set it low to like 5-10 seconds. I think the default in python is 30 seconds?

niemyjski commented 4 years ago

I'm also wondering if it could be some kind of dead lock due to HA being Async API and bond being a sync http call (sync over async).

geekofweek commented 4 years ago

I've not seen any other issue like this before, at least not in recent memory or that I can recall.

I also have it on an IoT VLAN, but home assistant is also on that VLAN so I don't believe that to be the issue. I'm still able to use the API manually running curl commands when HA stops responding. I can also still control the lights for the Fan, just not the fan itself. Which makes me think something is wonky with how the fan is implemented. I've been slowly walking the bond api looking for where there could be an issue without luck.

I do run into an issue where the Bond hub itself goes un-responsive from time to time. It can't even be reached via the bond app or ping, no idea what causes that. I setup a monitor and smart switch to restart it when that happens, but it doesn't coincide with this issue. After restarting it works again in HA and the Bond app without issue. This is something different that happens at a different time.

@Go0oSer what suggestions did you implement? The only one I see is the DHCP reservation / static IP which I already have. I did switch it from a hostname to IP address in the configuration, I doubt that should really be an issue but I tried it anyway.

Go0oSer commented 4 years ago

DHCP/Static IP and firewall exception for me , but I am running Bond and HA on separate networks.

Go0oSer commented 4 years ago

If the issue happens again, ill make note to test the lights vs the fan. I only recall testing the fan.

geekofweek commented 4 years ago

Originally I had HA and IoT devices in different VLANs, it got dicey with mDNS and opening so many firewall ports between the VLANs I figured it was better to reverse it and put HA in with the IoT devices and limit HA's access outside of it. Truthfully HA is probably my biggest security hole with it exposed to the internet, even with 2fa and proper certificates.

Go0oSer commented 4 years ago

Ive not seen this issue again since changing to DHCP reservation for the Bond Home and clearing a firewall entry for Bond to communicate bidirectionally with HA.

Go0oSer commented 4 years ago

So

I'm also wondering if it could be some kind of dead lock due to HA being Async API and bond being a sync http call (sync over async).

I think you may be on to something here. Reason why I say this is because recently I switched over to the core Bond component and the same thing is happening to me.

I completely rebuilt my container and OS and it started to happen very quickly there after. I also notice, when Bond is unable to communicate, attempting to reboot HA via the Frontend under Server Controls, hangs and gives me errors until I reboot the docker container itself.

Go0oSer commented 4 years ago

The library was rewritten since Bond became an official HA integration. This issue no longer happens. Likely library related in some way rather than with this particular integration.