chrisjshull / homebridge-nest

Nest plugin for HomeBridge
694 stars 111 forks source link

Nest devices are removed if they are offline when Homebridge is restarted #617

Closed marcelgood closed 9 months ago

marcelgood commented 1 year ago

This seems related to issue #299. Whenever my Nest thermostat is offline for some reason and Homebridge happens to restart during that time, then the thermostat disappears from the Home app instead of staying there and just be unresponsive. This is super annoying, because when it comes back I have to restart Homebridge and then the thermostat appears as a new device and gets moved to the default room and I have to move it back to the correct room. I'm on the new Homekit Architecture now if that makes a difference. The disappearance issue was there before I switched to the new architecture, though, but it didn't move it to the default room when it came back.

My understanding is that Homebridge caches accessories, so that when they are temporarily offline for some reason they don't immediately disappear. None of my other devices seem to disappear when they are temporarily offline and I restart Homebridge.

To Reproduce Steps to reproduce the behavior:

  1. Take Nest device offline
  2. Restart Homebridge

Expected behavior The Nest device shouldn't disappear just because it's temporarily offline. It should just be in an unresponsive state until it comes online again. It also shouldn't be moved to the default room when it comes back online.

Include with your bug report this version info:

pi@homebridge:/var/lib/homebridge $ node --version
v18.14.0
pi@homebridge:/var/lib/homebridge $ homebridge --version
1.6.1

Make sure you have the latest LTS from https://nodejs.org and the latest packages: npm upgrade -g homebridge homebridge-nest

Also include debug log output from startup through seeing the issue: DEBUG=* homebridge -D

mrjackyliang commented 1 year ago

I resolve this by using Home+ and making a backup. Every time this happens, I just do a restore.

github-actions[bot] commented 12 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

marcelgood commented 12 months ago

Any comments from the author on this?

adriancable commented 12 months ago

@marcelgood - can you post startup logs from the plug-in in the two cases where the devices are offline vs online so I can compare? Thanks!

marcelgood commented 11 months ago

@adriancable I will post the logs next time it happens. Don't really have time to deliberately make it happen and then having to clean it up again.

github-actions[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

marcelgood commented 9 months ago

@adriancable sorry I was sitting on this for a while, waiting for my thermostat to go offline. It happened again yesterday after a power outage, but I don't see anything useful in the logs. Basically when the thermostat is offline and Homebridge is restarted, then after [Nest] Fetching Nest devices it doesn't get any devices and the thermostat disappears from the accessory list in Homebridge.

Then when it comes back online and Homebridge is restarted it gets the device again after the fetch call and it adds it to the Default Room in Homebridge, and in Homekit it shows up under the same room named Default Room. I don't actually have a room called Default Room in Homekit, so it seems to use the room name that comes from Homebridge. I have the thermostat under a room named House as it is my whole house thermostat, so when this happens I have to move it back to House. I just went ahead and renamed the Default Room to House in Homebridge hoping that when this happens again it will not show up under Default Room in Homekit.

So, I'm not sure what you want me to post to help you isolate this issue. The log doesn't seem to have any useful information, other than the thermostat being absent if it's offline.