Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

All working for an hour or so then iPhone can't connect... #46

Closed
codersaur opened this issue Feb 19, 2016 · 37 comments
Closed

All working for an hour or so then iPhone can't connect... #46

codersaur opened this issue Feb 19, 2016 · 37 comments
Labels
bug Something isn't working as expected duplicate An issue or pull request for a similar issue already exists

Comments

@codersaur
Copy link

Hi,

I'm using the latest Raspbian build (2016-02-09) on a RasPi Model B. I've installed homebridge and homebridge-smartthings as per your instructions and everything works fine (can connect and control several switches and power meter devices on SmartThings). :)

However, after an hour or so my iPhone can no longer connect to any devices via homebridge. The only way I can get things working again is to empty '/var/homebridge/persist' and reset the HomeKit database on the iPhone. This has happened several times since installing 48 hrs ago. The homebridge server is typically still running (as a service using systemd) with no obvious errors and I still get a response if I browse to http://myhost:51826/accessories, so looking for some help as I'm not sure where the issue could lie.

Thanks.

@KumarMudedla
Copy link
Contributor

I am having the same issue from yesterday with the new update. I had this issue on Raspberry Pi initially but the reason was my network switch , the issue got resolved by connecting Raspberry Pi directly to router and it worked fine for a week and I am seeing the same issue from yesterday.

Checking different things to see what is causing the issue.

@pdlove
Copy link
Contributor

pdlove commented Feb 19, 2016

@codersaur can you try only removing the IdentifierCache file in persist and seeing if it works?
I think the only difference between our setups is that I'm still launching home bridge manually.
You can also adjust polling_seconds to 60 and see if your phone disconnects after just a minute.
I have an issue where my phone loses most of the devices when I leave and return home and power cycling my phone brings them back. My tablet that stays at home always keeps them.

@asrusch
Copy link

asrusch commented Feb 19, 2016

Note: I have the same issue when I leave home, when I return nothing will connect. I have not tried power cycling, I just remove persist and re-add.

I will try those things as well and let you know.

@asrusch
Copy link

asrusch commented Feb 19, 2016

It appears my phone was ok for > 1 hour, but I after I got the #45 etimedout error and was not able to get reconnected without removing persist, everything from homekit, and starting over.

@pdlove
Copy link
Contributor

pdlove commented Feb 19, 2016

I'm going to do an update tonight that allows the subscription based updates to be disabled and make that the default with a reasonable poll interval. I'll then develop a methodology for finding why the phone looses the Homebridge. Usually it's because an attribute is set to an invalid setting, but that should make you lose all accessories unlike just some of them as many of us are experiencing.

@pdlove pdlove removed the bug Something isn't working as expected label Feb 19, 2016
@asrusch
Copy link

asrusch commented Feb 19, 2016

I lose all my accessories, FYI.

On Friday, February 19, 2016, pdlove notifications@github.com wrote:

I'm going to do an update tonight that allows the subscription based
updates to be disabled and make that the default with a reasonable poll
interval. I'll then develop a methodology for finding why the phone looses
the Homebridge. Usually it's because an attribute is set to an invalid
setting, but that should make you lose all accessories unlike just some of
them as many of us are experiencing.


Reply to this email directly or view it on GitHub
#46 (comment)
.

@pdlove pdlove added bug Something isn't working as expected duplicate An issue or pull request for a similar issue already exists labels Feb 19, 2016
@asrusch
Copy link

asrusch commented Feb 19, 2016

I should also note that I change my switches to "light bulbs" in HomeKit
because Siri does not understand they are lights. So if I say "turn off all
the lights," she won't turn off the light switches unless I change them to
"light bulbs."

Maybe that is an invalid setting causing the issues?

On Friday, February 19, 2016, Andy Rusch asrusch@gmail.com wrote:

I lose all my accessories, FYI.

On Friday, February 19, 2016, pdlove <notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

I'm going to do an update tonight that allows the subscription based
updates to be disabled and make that the default with a reasonable poll
interval. I'll then develop a methodology for finding why the phone looses
the Homebridge. Usually it's because an attribute is set to an invalid
setting, but that should make you lose all accessories unlike just some of
them as many of us are experiencing.


Reply to this email directly or view it on GitHub
#46 (comment)
.

@pdlove
Copy link
Contributor

pdlove commented Feb 19, 2016

At least one person other than myself has reported losing most, but not all. After looking over it, I think it's a difference in the way IOS 9.3 beta works vs 9.2. Just a guess. Either way, it's badly broke and the only real change made was that it is using the subscriptions. The polling portion of it is identical.

@rickybloomfield
Copy link

When I lose them, it's all of them. I'm still running iOS 9.2.

@codersaur
Copy link
Author

Hey all, busy weekend, but finally got some time to post the results of my testing.

To clarify, I am using iOS v9.2. (9.2.1 on a 6S to be exact), and using Elgato Eve to manage the HomeKit database.
Also, I was having this issue while running homebridge manually from the command line (user: pi), which is what prompted me to try running homebridge as a service, but that didn't resolve the issue.

Testing log:

Starting from when the phone has already lost connectivity to Homebridge...

  1. Removing IdentifierCache:
    • Did not resolve the issue.
  2. Power cycling the iPhone:
    • Did not resolve the issue.
  3. Stop/Starting homebridge and changing "polling_seconds" to 60:
    • Did not resolve the issue.
  4. Removing everything in /var/homebridge/persist/ and restarting homebridge:
    • Did not resolve the issue.
  5. Resetting the Homekit database in iPhone settings:
    • Homebridge is now available to re-add in Elgato Eve.
  6. Re adding Homebridge:
    • Pairs and everything works.
  7. Keeping phone awake for 5 mins:
    • Can still successfully issue commands to SmartThings devices (via Eve or via Siri) and characteristic values update. Interestingly, in Elgato Evo, one device (metering switch) shows as "Updated 5 Minutes Ago" (even though values for ON/OFF are still updated correctly).
  8. Forcing a refresh of devices in Elgato Eve (by dragging the screen down):
    • the capability values are updated, but the status for the metering switch is still "Updated 5 Minutes Ago". Another device (basic switch) shows "Updated Now".
  9. Airplane mode for 1 min, followed by locked for 5 mins:
    • Still able to send commands and see updated Power ON/OFF values for both devices, however devices show "Updated x Minutes Ago".
  10. Letting phone go to sleep for 1.5 hrs:
    • All connectivity lost. Eve no longer allows the ON/OFF status to be changed. Interestingly, at this point, I can see from systemctl status homebridge -l that a pair verify has taken place...
Feb 19 12:50:18 raspi2 homebridge[2525]: Fri, 19 Feb 2016 12:50:18 GMT HAPServer [CC:22:3D:E3:CE:32] Pair verify step 1/2
Feb 19 12:50:19 raspi2 homebridge[2525]: Fri, 19 Feb 2016 12:50:19 GMT EventedHTTPServer [fe80::48d:329c:8bcf:b289] HTTP Repsonse is finished
Feb 19 12:50:19 raspi2 homebridge[2525]: Fri, 19 Feb 2016 12:50:19 GMT EventedHTTPServer [fe80::48d:329c:8bcf:b289] HTTP request: /pair-verify
Feb 19 12:50:19 raspi2 homebridge[2525]: Fri, 19 Feb 2016 12:50:19 GMT HAPServer [CC:22:3D:E3:CE:32] HAP Request: POST /pair-verify
Feb 19 12:50:19 raspi2 homebridge[2525]: Fri, 19 Feb 2016 12:50:19 GMT HAPServer [CC:22:3D:E3:CE:32] Pair verify step 2/2
Feb 19 12:50:19 raspi2 homebridge[2525]: Fri, 19 Feb 2016 12:50:19 GMT HAPServer [CC:22:3D:E3:CE:32] Client 55360D88-A21E-46A4-8B47-E7802165EA86 verification complete
Feb 19 12:50:19 raspi2 homebridge[2525]: Fri, 19 Feb 2016 12:50:19 GMT EventedHTTPServer [fe80::48d:329c:8bcf:b289] HTTP Repsonse is finished
Feb 19 12:50:19 raspi2 homebridge[2525]: Fri, 19 Feb 2016 12:50:19 GMT EventedHTTPServer [fe80::48d:329c:8bcf:b289] HTTP request: /accessories
Feb 19 12:50:19 raspi2 homebridge[2525]: Fri, 19 Feb 2016 12:50:19 GMT HAPServer [CC:22:3D:E3:CE:32] HAP Request: GET /accessories
Feb 19 12:50:19 raspi2 homebridge[2525]: Fri, 19 Feb 2016 12:50:19 GMT EventedHTTPServer [fe80::48d:329c:8bcf:b289] HTTP Repsonse is finished
  1. After more time has passed:
    • Begin to see ETIMEDOUT errors:
Feb 19 13:10:10 raspi2 homebridge[2525]: Fri, 19 Feb 2016 13:10:10 GMT EventedHTTPServer [fe80::48d:329c:8bcf:b289] Sending HTTP event 'keepalive' with data: {"characte                                                                     ristics":[]}
Feb 19 13:20:10 raspi2 homebridge[2525]: Fri, 19 Feb 2016 13:20:10 GMT EventedHTTPServer [fe80::48d:329c:8bcf:b289] Sending HTTP event 'keepalive' with data: {"characte                                                                     ristics":[]}
Feb 19 13:30:10 raspi2 homebridge[2525]: Fri, 19 Feb 2016 13:30:10 GMT EventedHTTPServer [fe80::48d:329c:8bcf:b289] Sending HTTP event 'keepalive' with data: {"characte                                                                     ristics":[]}
Feb 19 13:36:15 raspi2 homebridge[2525]: Fri, 19 Feb 2016 13:36:15 GMT EventedHTTPServer [fe80::48d:329c:8bcf:b289] Client connection error: read ETIMEDOUT
Feb 19 13:36:15 raspi2 homebridge[2525]: Fri, 19 Feb 2016 13:36:15 GMT EventedHTTPServer [fe80::48d:329c:8bcf:b289] Client connection closed
Feb 19 13:36:15 raspi2 homebridge[2525]: Fri, 19 Feb 2016 13:36:15 GMT EventedHTTPServer [fe80::48d:329c:8bcf:b289] HTTP connection was closed
Feb 19 13:36:15 raspi2 homebridge[2525]: Fri, 19 Feb 2016 13:36:15 GMT EventedHTTPServer [fe80::48d:329c:8bcf:b289] HTTP server was closed

*Conclusions: *

  • There's a bug somewhere, Eve thinks the device hasn't updated for x minutes, despite correctly showing the latest values and still being able to send commands and receive updates.
  • The problem doesn't seem related to the value of "polling_seconds". With Polling_seconds set to 60, everything was still working fro ~1hr.
  • Possibly the Pair Verify step fails (does iOS try to run pair verification every hour?), even though we see "verification complete" in the Homebridge log?

Some other issues (which could be entirely Elgato Eve problems or other related problems):

  • In Eve, my metering z-wave switch shows two sets of ON/OFF controls. The top headline one does nothing.
  • The "Consumption" figure (which I assume should show the live "power" figure in W) never updates, it's always zero despite showing ~20W in SmartThings. Interestigly, Homebridge does appear to be getting the live power figures, but they don't show in Elgato Eve.

Feb 19 11:27:34 raspi2 homebridge[2525]: Fri, 19 Feb 2016 11:27:34 GMT EventedHTTPServer [::ffff:192.168.71.108] Sending HTTP event '3.13' with data: {"characteristics":[{"aid":3,"iid":13,"value":"19.0"}]}

@rickybloomfield
Copy link

I was seeing pretty much this exact behavior since updating to 4.3. I removed the Homebridge device this morning and re-added it after deleting the "persist" folder and changing the username in the config.json file. It seems to be stable now for the past 4 hours or so without the inconsistency between when Eve said it was last updated and the functionality (I was seeing that previously), although I'm now seeing the ETIMEDOUT and ENOTFOUND errors:

image

@rickybloomfield
Copy link

FYI, since posting this everything has actually been running fine. No issues in a couple days.

@asrusch
Copy link

asrusch commented Feb 23, 2016

No issues after your device leaves and returns to the network?

On Mon, Feb 22, 2016 at 4:43 PM, Ricky Bloomfield notifications@github.com
wrote:

FYI, since posting this everything has actually been running fine. No
issues in a couple days.


Reply to this email directly or view it on GitHub
#46 (comment)
.

@rickybloomfield
Copy link

Nope. I've done that many times over the last few days. Works on and off the network.

@asrusch
Copy link

asrusch commented Feb 23, 2016

I simulated leaving (turning off Wifi) and coming back (turning back on), and i get an error on Homebridge.


Feb 22 18:26:26 homebridge homebridge[890]: hostname: 'graph.api.smartthings.com',
Feb 22 18:26:26 homebridge homebridge[890]: host: ''graph.api.smartthings.com',
Feb 22 18:26:26 homebridge homebridge[890]: port: '443' }
Feb 22 18:26:26 homebridge homebridge[890]: error at req: { [Error:getaddrinfo EAI_AGAIN graph.api.smartthings.com:443]
Feb 22 18:26:26 homebridge homebridge[890]: code: 'EAI_AGAIN',
Feb 22 18:26:26 homebridge homebridge[890]: errno: 'EAI_AGAIN',
Feb 22 18:26:26 homebridge homebridge[890]: syscall: 'getaddrinfo',
Feb 22 18:26:26 homebridge homebridge[890]: hostname: 'graph.api.smartthings.com',
Feb 22 18:26:26 homebridge homebridge[890]: host: 'graph.api.smartthings.com',
Feb 22 18:26:26 homebridge homebridge[890]: port: '443' }

After that error, my nic fails to ping out and I cannot SSH in. I reboot the VM and it comes back.

I was able to get it to come back once, but when I tried a second time, it came back as not reachable, and threw the above error.

I should note I have an AppleTV that theoretically supports remote Homekit, but I have never been able to get it to work with Homebridge. It works with my Ecobee.

I am thinking there might be an issue with my environment. I am going to try another version of Ubuntu and perhaps even a bare metal install of it.

@asrusch
Copy link

asrusch commented Feb 23, 2016

I'm about ready to give up. I just completely reinstalled my OS and everything. Homebridge starts up, it adds all my ST devices, gives me the scan code, etc. But my phone refuses to see it. I've changed the Bridge name and username a dozen times. Cleared persist, etc. Just will not show up. It was doing this before the reinstall as well, but I usually would get it on the 3rd or 4th time of changing the name, etc. Very aggravating!

@humac
Copy link

humac commented Feb 23, 2016

What iOS app are u using for managing HomeKit? I was using Idevices but it wasn't adding homebridge when I switched to the eve app and it worked. But now I have a problem of the devices disappearing after sometime. I have to restart homebridge and restart the eve app and they appear again.

@asrusch
Copy link

asrusch commented Feb 23, 2016

I am using "Home." I had no problems with it for some time. I was able to add the Homebridge no problem for a week or so. Only recently was it having issues.

Eve - same thing. It will not find the Homebridge even though it found all my ST devices and is running fine.

@pdlove
Copy link
Contributor

pdlove commented Feb 23, 2016

@rickybloomfield Are you saying that it was messing up but everything has stabilized and it is working fine now?

@pdlove
Copy link
Contributor

pdlove commented Feb 23, 2016

@coolcom: I have the latest model of Apple TV and have nothing but trouble with remote access.
My local iPad retains perfect devices but my phone loses when I leave and return.

@pdlove
Copy link
Contributor

pdlove commented Feb 23, 2016

What version of hap-nodejs are do y'all have? I recently redid my system and know the latest hap-nodejs is on it. several posts on the main homebridge have indicated recent fixes have improved stability.

@asrusch
Copy link

asrusch commented Feb 23, 2016

I have 5.6 of node- is hap-nodejs different? How do I check?

@rickybloomfield
Copy link

@pdlove Yes, that's what I'm saying.

@codersaur
Copy link
Author

What version of hap-nodejs are do y'all have?

I have v5.6.0 of Node.
Checking in '/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/package.json' I can see that I have v.0.2.3 of hap-nodejs (this is what was installed when I did a fresh install on Feb 18th).

I can see there is a new version v.0.2.5 now from https://github.com/KhaosT/HAP-NodeJS

@realdannys
Copy link

Just wanted to say, having not but problems here, the combination of this and Wemo have totally stopped everything in Homebridge working. Its a shame because the old version of Homebridge with the old Wemo plugin worked fine, and now I've basically lost Siri control of everything. For the record i'm just getting this repeated over and over...

error at req:  { [Error: getaddrinfo ENOTFOUND graph-eu01-euwest1.api.smartthings.com graph-eu01-euwest1.api.smartthings.com:443]

code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'graph-eu01-euwest1.api.smartthings.com',
host: 'graph-eu01-euwest1.api.smartthings.com',
port: '443' }

And I haven't left the house, that just happens after restarting Homebridge and an hour or so later.

@rickybloomfield
Copy link

@codersaur Looks like I have 0.2.3 of hap-nodejs (the one installed with homebridge) and version 4.2.4 of NodeJS. Not the latest, but everything seems to be working.

@pdlove
Copy link
Contributor

pdlove commented Feb 23, 2016

ENOTFOUND is a DNS issue as is the EAI_AGAIN error. I've looked several times and I can't find any reference to it being anything but a DNS resolution failure.

@realdannys
Copy link

My Homebridge is totally broken now, all the devices have disappeared and I can't get them back. Wish id never upgraded anything to be honest...

@pdlove
Copy link
Contributor

pdlove commented Mar 14, 2016

Try this with plugin version 0.4.4. I've corrected a lot on the error handling. You'll still get the connection errors because that is all smart things being an issue.... but it shouldn't cause home bridge to crash as it has been doing.

@codersaur
Copy link
Author

Thanks for the update @pdlove. However, I've tested with the latest update this morning, but still the same issue. All devices have become unreachable after a hour or so, and restarting homebridge doesn't get it working again. :(

Let me know if there are some more-detailed logs I can grab for diagnosis...

@codersaur
Copy link
Author

I should add that I don't think it is home bridge that is crashing, looking at the logs it is continuing to receive state changes from SmartThings even after communication with my iPhone has died.

@pdlove
Copy link
Contributor

pdlove commented Mar 14, 2016

codersaur, can I get a dump of your accessories json from homebridge after the communication issue occurs? For example, my homebridge server is 192.168.0.4, so I go here for the dump: http://192.168.0.4:51826/accessories
I'm having some issues connecting to devices with my install on FreeNAS and here I'm getting a status of -70401. No idea what that means yet, but I'd expect alot more information than that.

@pdlove
Copy link
Contributor

pdlove commented Mar 14, 2016

If you get a status of -70401 then you'll need to run homebridge with the -I parameter in order to allow "Insecure mode".

@codersaur
Copy link
Author

I was getting a status of -70401 too (which incidentally is the response I was referring to in my original post). Restarted with the -I parameter and it gives a lot more info about each device. Probably best not to post here though. What's the best way to share it with you? I thought I saw your email somewhere in the code, but can't find it. I could PM you on the SmartThings community forum if you have an account there?

Also, is the -I parameter something that should be used in normal operation, or only for debugging?

@pdlove
Copy link
Contributor

pdlove commented Mar 14, 2016

My email is pdlovelace@gmail.com
I may not be able to do much with it at this point. I primarily wanted to make sure that it works and doesn't produce errors. If you can go ahead and send it, I'll check for obvious errors. Make sure it is currently in the non-working state when you get it.

@realdannys
Copy link

@pdlove no change for me with the update either i'm afraid. Errors on everything shortly after starting Homebridge. I ran the URL you mentioned above and too downloaded a file containing {"status":-70401}. When it goes offline though I can't even access that URL until I restart Homebridge.

@pdlove
Copy link
Contributor

pdlove commented Mar 20, 2016

I'm moving all discussion to issue #58. I was able to iron out one major issue last night an just released that as 0.4.6.

@pdlove pdlove closed this as completed Mar 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working as expected duplicate An issue or pull request for a similar issue already exists
Projects
None yet
Development

No branches or pull requests

8 participants
@rickybloomfield @realdannys @pdlove @humac @KumarMudedla @codersaur @asrusch and others