Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homekit intermittent problem with 'No response' on IOS devices #15675

Closed
jr3us opened this issue Jul 25, 2018 · 52 comments
Closed

Homekit intermittent problem with 'No response' on IOS devices #15675

jr3us opened this issue Jul 25, 2018 · 52 comments
Assignees

Comments

@jr3us
Copy link

jr3us commented Jul 25, 2018

Home Assistant release with the issue:

Version 74.0 on hassbian stretch running on a raspberry pi 3b. I have also tried a 3b plus, but have same problem.

Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.):

I am using hassbian

Component/platform:

Description of problem:

I am having an intermittent problem with the homekit builtin bridge.
Sometimes all the accessories show no response in the IOS Home app,
and to my experience the only way to get them back is to trigger homekit
in the web interface. I am currently on HA .74.0.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

I have the following information in configuration.yaml. Note that I do have z-wave, so I added the automation to start HomeKit after wave is ready/complete.

homekit:
  auto_start: False

automation:
  - alias: 'Start HomeKit'
    trigger:
      - platform: event
        event_type: zwave.network_ready
      - platform: event
        event_type: zwave.network_complete
    action:
      - service: homekit.start

# Show links to resources in log and frontend
introduction:

logger:
  default: warning
  logs:
    homeassistant.components.homekit: debug
    pyhap: debug

Traceback (if applicable):


Additional information:

I am using an apple tv 4k as the homekit hub, but it doesn't appear to be involved when the IOS devices are attached to the same network as the HA server is.

In the following debug statements, 192.168.1.20 is my Apple TV 4k, and 1.29168.1.23 is my iPhone:

2018-07-20 12:31:00 DEBUG (Thread-26) [pyhap.accessory_driver] Could not send event to ('192.168.1.20', 55172), probably stale socket.
2018-07-20 12:31:00 DEBUG (Thread-26) [pyhap.accessory_driver] Could not send event to ('192.168.1.23', 49531), probably stale socket.

Any ideas where I have gone wrong? Any additional information I need to provide?

@pleeja
Copy link

pleeja commented Jul 30, 2018

What do you mean by triggering HomeKit in the web interface?

@jr3us
Copy link
Author

jr3us commented Aug 1, 2018

Apologies for the confusion. The I triggered the automation referenced above through the web interface.

Additional notes:

I tried a different raspberry pi, and still received the errors, and also moved the pi to a different ethernet port on the switch as well as using a different ethernet cable. neither of these 3 steps changed anything regarding the issue or the debug statements.

I then also recreated the hassbian server with a fresh download of the hassbian image and I am still having the issue.

Thanks!

@jr3us
Copy link
Author

jr3us commented Aug 9, 2018

Any ideas how I can troubleshoot this? I am getting a bit lost in the layers of classes for homekit.

I am particularly interested in finding where I can put in some debug statements for incoming requests from the iOS device.
Thanks!

@kirichkov
Copy link
Contributor

kirichkov commented Aug 13, 2018

I have a similar issue, but triggering the homekit.start automation doesn't help at all. HomeKit stopped working on my iOS 11.4 devices, but is working just fine on an old iPhone running ios 9.3.5. I'm suspecting it's an iOS/ AirPlay2 - related issue, introduced with ios 11.4.1, rather than a HASS issue.

The only thing that actually resolves the problem is restarting the iOS device and it works for some time, then after a while I get "not responding".

@jr3us
Copy link
Author

jr3us commented Aug 13, 2018

I have also found that restarting the home assistant server will also give it a roughly 1 hour time for it to work correctly, and not give the not responding message.

@jr3us
Copy link
Author

jr3us commented Aug 13, 2018

I wonder if it could be related to power saving in iOS turning off wifi when not in use and the stale sockets may not be stale.. Pure guessing on my part.

@kirichkov
Copy link
Contributor

kirichkov commented Aug 14, 2018

I'm also speculating something similar I have extremely often power cuts so my Raspberry Pi and my WiFi router to restart qiute often and this might be causing ios, being battery powered, to not properly close the communication sockets and trying to reuse them, while they are closed on the other side.

@basvankuijck
Copy link

I've got a similar problem. I've installed HASS manually on my raspberry pi. Configuration of home kit in configuration.yaml is as simple as:

homekit:

The problem occurs every morning when I wake up and want to turn on my lights using siri (-> Apple home app). The home app tells me all of the accessories are not responding. After opening the home-assistant iOS app, the accessories in the apple home app immediatelly respond.

@ASchneiderBR
Copy link

Same problems here... When using over 4G (iPad as Hub) all accessories shows as unavailable but they work and update state. Only the Home Assistant bridge is unavailable. Using it on LAN everything works perfectly. Thanks.

@SebDominguez-zz
Copy link

SebDominguez-zz commented Oct 2, 2018

I was having the same issue using node-red and homebridge. I thought that switching to hassio with native homekit support would help.

@jr3us
Copy link
Author

jr3us commented Oct 2, 2018

Did hassio help the IOS homekit connection?

@SebDominguez-zz
Copy link

Unfortunately no, I’m having the exact same behavior that with Homebridge / HAP-Nodejs. Home.app works for a couple of hours and then the objects are “not responding”. Rebooting the Pi fix the issue temporarily.
I noticed that if I’m experimenting an internet outage/ router reboot trigger this “no responding” bug.
Some people are saying that this is due to mDNS not being broadcasted correctly, some others that this is a poor local network installation / hardware.

@danerich
Copy link

danerich commented Oct 2, 2018

Having the same issue on hassio 0.79.2 on Raspberry Pi 3 64.

@kirichkov
Copy link
Contributor

Upgrading to iOS 12, has improved things for me so far.

@Dreamray
Copy link

Same problems here. ha 0.78.3 on debian on hyper-v(win10), ios 12,

@mbo18
Copy link
Contributor

mbo18 commented Oct 23, 2018

Same issue here: iPhone with iOS 12.0.1, AppleTV 4 iOS 12.0.1, HA 0.80.3 on HassOS 2.2
2018-10-23 13:36:51 DEBUG (Thread-12) [pyhap.accessory_driver] Could not send event to ('10.2.10.9', 49448), probably stale socket.
I have thousand lines like this in logs (10.2.10.9 is my AppleTV)
If I restart HA, it works the first time I lauch the Home app and then it stops. Home app says "No Response" for all devices except my AppleTV which is just fine.

@mbo18
Copy link
Contributor

mbo18 commented Oct 24, 2018

I have disabled IPv6 on my ISP router and everything is working as expected now... I don't know if it's an issue between the homekit component and IPv6 or if IPv6 is not correclty supported on my ISP router

@dmonagle
Copy link

There is a definite bug that also causes these symptoms. There is another open issue here that refers to it:

#16692

My testing today has shown that with the dev branch of HAP python, my homekit accessory bridge runs flawlessly. With the current release, my devices go to "No Response" within minutes.

@jr3us
Copy link
Author

jr3us commented Oct 27, 2018

After updating to .80.0 today, the connection between homekit and iOS worked fine for about an hour, and then started the no response message again. Also, the message about stale sockets has not changed.

@dmonagle
Copy link

The release with that patch in it is 0.81.0. Is that what you meant? I'm actually still having trouble with HomeKit on hassio after the upgrade. When I manually installed HAP Python previously I was able to keep connections much longer. I'm going to set up on hassbian and see what I can figure out.

@jr3us
Copy link
Author

jr3us commented Oct 28, 2018

apologies. I did upgrade to.81.0. the same comments about stale sockets still apply.

@cdce8p cdce8p self-assigned this Oct 28, 2018
@cdce8p
Copy link
Member

cdce8p commented Oct 28, 2018

@dmonagle Would be great if you can give an update ones you find something. Just so that I know if we can fix it or if I need to move this to the HAP-python repo.

@dmonagle
Copy link

@cdce8p I'm sorry, I haven't been able to figure out anything. It appears I'm running the new HAP-python, however it's still showing the same symptoms. The one difference is that when i successfully tested a working HomeKit setup, I set up a complete new database and config. With my "production" system I restore my entire config and database.

I really cannot see any reason that my config or db would cause the issue, but since I've hit a bit of a dead end, I may set up a completely empty new system on the weekend, enable homekit, test it and then build it all up from there.

@cdce8p cdce8p mentioned this issue Oct 31, 2018
2 tasks
@cdce8p
Copy link
Member

cdce8p commented Nov 2, 2018

@dmonagle I have reverted the HAP-python update for now. Can you give some more information which systems your using and how your setup is?

  • Operations system (Hassio, Hassbian, ...)
  • Python and Home Assistant versions, later ideally be 0.81.3 once that is released later today
  • How many iOS devices? (Does it improve with only one device?)
  • Anything else you might find relevant

@jr3us
Copy link
Author

jr3us commented Nov 2, 2018

@cdce8p , @dmonagle ,

I have updated to .81.4 and rebooted the RPi this morning, and after updating, Homekit/Home Assistant worked as it should for about 20 minutes. I am now getting No Response on the IOS devices(iPhone and iPad both running 12.0.1). I am also seeing stale socket messages as above, and also a couple of sockets in CLOSE_WAIT state.

If I can assist you, let me know.

Regards

@Dreamray
Copy link

Dreamray commented Nov 6, 2018

Same problems here. ha 0.78.3 on debian on hyper-v(win10), ios 12,

I have installed HA on my win10(not on hyper-v, install python for windows first, then install HA), and deleted network setting of hyper-v. HA and homekit works very well now

@dmonagle
Copy link

dmonagle commented Nov 7, 2018

@cdce8p
Sorry about the slow response, I actually had a few days holiday. So the setup I see this problem is either raspbian or hassio. When I did testing on my Mac, I didn't see it. My production system is

0.81.5 - soon to be 0.81.6
I'm only including a few flux switches and and alarm panel for HomeKit
I have 4 Apple TVs, Two Macs, 4 iPads, 2 iPhones and a HomePod on the network that are registered with HomeKit.
Without fail the switches and alarm panel change to "Not Responding" within a minute of starting Home Assistant. Alerts from HomeKit still come through to the devices even when "Not Responding" is being shown.
As mentioned before, I couldn't replicate this while running in a python virtual environment on my Mac.

@jr3us
Copy link
Author

jr3us commented Nov 30, 2018

After uprading to 83.1 this morning, and still using the same platform as described initially, I am also seeing that I have no response more often than I have valid information in the Home app for iOS.

As @dmonagle indicated on pull request #18355, the status for devices in Home will work correctly for a few minutes, and then go No response for 4 or 5 minutes.

Side note:
I had to comment out the start up automation I used above as homeassistant complained about the action: homekit.start. I also removed the autostart False so it would start up.

Regards

@ASchneiderBR
Copy link

Hello, I am also facing this problem, again. It was OK for the past few months, now updating to 83.1 it started all over again. Homekit works fine for the first 10 mins then goes numb, nothing updates on Home App.

@ASchneiderBR
Copy link

Hello @jr3us! I see you have the problem as I do. Do you use Hassio? Is it possible to revert back HAP-python to previous version? It was working great for me on 81.6. Thanks!

@jr3us
Copy link
Author

jr3us commented Dec 2, 2018

i use hassbian and don't know if possible to revert back. This version does solve a problem I had regarding the close wait state on TCP connections not getting closed.

@ASchneiderBR
Copy link

Thanks. I will have to fix this problem that started again on version 83. Too bad because it was working flawlessly for the past few months. There is nothing significant or error on log, I have no idea were to start.

@pleeja
Copy link

pleeja commented Dec 2, 2018

I was also having this problem when I started with HA but for some reason it works great now and I don't know what changed..

@cdce8p
Copy link
Member

cdce8p commented Dec 2, 2018

@tatunts I was thinking if I should revert the latest updates to HAP-python, but although you are experiencing issues, it also fixed others. That's why I haven't so far. Unfortunately the server part that communicates with HomeKit is the one area I can't really contribute to / fix issues. It might help to open a separate issue inside the HAP-python repo, especially: https://github.com/ikalchev/HAP-python/issues
At the moment that's the best I can do to help.

@jr3us
Copy link
Author

jr3us commented Dec 3, 2018

I have copied my comment from earlier over to ikalchev's HAP-Python.

@WhiteDogBe
Copy link

I am also having issues since 83. HomeKit itself is working fine: I can control devices and everything in the Home app reflects the correct status. However, I am not receiving any push notifications. Once I restart HA though, for a few hours push notifications work again.

@lingqi-su
Copy link

lingqi-su commented Dec 5, 2018

I'm kind of having similar problems. I’'m running hassbian (0.83.3) on my raspberry pi 2 with an external usb bluetooth dongle. I bought several Xiaomi bluetooth temperature and humidity sensor and I would like to check the temperature on my iPhone 6 (iOS 9). The temperature value can be seen on hassbian.local:8123, but my iPhone keeps telling me that the sensors give no response. However, my other bluetooth devices like eq-3 thermostat can be still controlled over my iPhone 6 (iOS 9).

@jr3us
Copy link
Author

jr3us commented Dec 8, 2018

@cdce8p ,@ikalchev, @xbtsw: I have found some info on differences between python3.5(used in hassbian) and python 3.6+; quoting python.org(https://docs.python.org/3/library/asyncio.html#module-asyncio) as follows for the diffs between 3.5 and 3.6:

The asyncio module has received new features, significant usability and performance improvements, and a fair amount of bug fixes. Starting with Python 3.6 the asyncio module is no longer provisional and its API is considered stable.

asyncio is used heavily in HAP-python as well as in home-assistant.

Could this be related to the problem?

@cdce8p
Copy link
Member

cdce8p commented Dec 8, 2018

@jr3us Unfortunately it's probably not the case. Also both use asyncio, the server part of HAP-python that connects to the devices still isn't.

@warcanoid
Copy link

I am also having issues since 83. HomeKit itself is working fine: I can control devices and everything in the Home app reflects the correct status. However, I am not receiving any push notifications. Once I restart HA though, for a few hours push notifications work again.

Same problem with hassio 0.83.x

@ikalchev
Copy link

ikalchev commented Dec 9, 2018

It is possible that the thread that sends the notifications has crashed - this should be now fixed on HAP-python at dev at latest. Now we are trying to figure out if there is a further issue (see the referenced issue in HAP-python)

Another observation based on the comments I read: is it possible that HAP advertises one address, but is actually running on another? I think @xbtsw described something similar.

I am still trying to reproduce this without HA

@warcanoid
Copy link

warcanoid commented Dec 9, 2018

@ikalchev finnaly found you, one question for you: when will be the camera component(
ikalchev/HAP-python#53 )for home kit, implemented in home assistant?

@ikalchev
Copy link

ikalchev commented Dec 9, 2018

I implemented the camera in HAP-python 1-2 months ago, but I think you should ask @cdce8p about it’s integration into HA.

But If you want to give it a go without HA until that is ready, the README in HAP-python has some pointers.

@warcanoid
Copy link

Thanks, have tried this, but it is too complicated for me to set up, will wait for the implemetation.

@giuseppe4
Copy link

Hi, I’m having the same issue, any update on this?

@jporter-dev
Copy link

I am having this issue, but I noticed it only occurs when accessing remotely. When on my LAN, everything works fine and is snappy, but when trying remotely, I get intermittent "Not Responding" which clears up 5-10 mins later. Not sure if 100% related, as the remote-only aspect makes me believe it's a networking issue.

@ranunculales
Copy link

ranunculales commented Feb 1, 2019

Same, same; nearly 90% of my devices are HomeKit but paired to HA. I reboot Hass.io, everything seems stable, then after a few minutes, devices start reporting in that they take longer that 10 seconds and then soon after start reporting they failed to update at all. Automations and scenes degrade to the point that the system is unstable and I need to reboot it... I'm using a dedicated RPI 3B+ for HA, Homekit running through an AppleTV 4K. This happened in 0.85, but seems to be more frequent since upgrading to 0.86+.

@gsotiriou
Copy link

gsotiriou commented Feb 6, 2019

Similarly to @joshporter1 above my devices are all responding and playing nice when I'm on the same WiFi network as my HA instance. When I'm outside on my data plan all devices turn to "Unavailable" accompanied by an exclamation mark. Pressing on a device in this state does nothing. Hard pressing on it presents the message: "This accessory is unavailable. To control it when you're away from home, set up a home hub."
Which is weird considering that it works fine when I'm at home.

@ASchneiderBR
Copy link

Which is weird considering that it works fine when I'm at home.

Hello sir. Have you setup an apple device (ipad mini, apple tv or homepod) as home hub?

You will need it in order to access outside your wifi network.

@gsotiriou
Copy link

gsotiriou commented Feb 6, 2019

Which is weird considering that it works fine when I'm at home.

Hello sir. Have you setup an apple device (ipad mini, apple tv or homepod) as home hub?

You will need it in order to access outside your wifi network.

Hello, I thought that the homekit: component should/would take care of something like that. I was under the impression that once pairing with Homekit (pin , iOS setup etc.) and putting in the proper configuration in configuration.yaml , that was all I needed to control my devices in and out of home.

Edit: Nevermind - I did some more digging and saw that (by Apple) only LAN access is allowed to the devices. I need to have an Apple device such as the one mentioned to have external access. That is bad.

Edit2: Actually this happens because home assistant is not "Homekit compatible" and thus a home hub is needed?

@bluepixel00
Copy link

bluepixel00 commented Feb 6, 2019 via email

@jr3us
Copy link
Author

jr3us commented Feb 27, 2019

Looks like this can be closed now.

Thanks to @ikalchev and @cdce8p for getting this fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests