ebaauw / homebridge-nb

Homebridge plugin for Nuki Bridge
Apache License 2.0
52 stars 3 forks source link

Every homebridge reboot generate a new callback id #9

Closed MikeDeltaHH closed 3 years ago

MikeDeltaHH commented 3 years ago

II´ve deleted all callbacks ids last week but homebridge now reported again too many callbacks in the logs - i made some tests - every homebridge reboot generates a new callback id because nb use different ports, as example:

homebridge@homebridge-server:~$ nb -H 192.168.2.55:8080 -T xxx callbackList { "callbacks": [ { "id": 0, "url": "http://192.168.2.251:38431/notify/5DDE33F4" }, { "id": 1, "url": "http://192.168.2.251:40095/notify/5DDE33F4" }, { "id": 2, "url": "http://192.168.2.251:37069/notify/5DDE33F4" }

ebaauw commented 3 years ago

How do you reboot Homebridge? Homebridge NB removes the callback on controlled shutdown, so they shouldn’t linger.

MikeDeltaHH commented 3 years ago

Reboot every night the complete ubuntu server as a planned task but a manual homebridge restart with config-ui-x (after a plugin update as an example) has the same effect!

ebaauw commented 3 years ago

How do you stop homebridge?

MikeDeltaHH commented 3 years ago

In config-ui-x i do a restart over the restart button:

Reboot HB

Nightly reboot over a planned cron job:

daily reboot

ebaauw commented 3 years ago

Could you please enable debug mode, restart Homebridge and attach the logfile?

I don’t think reboot does a clean shutdown. Better use shutdown -r now.

MikeDeltaHH commented 3 years ago

I change the cron job command to "shutdown -r now" and execute the job (reboot the wohle server) , but with no success - the callback id´s are not deleted!

Enable debug mode, restart homebridge, here is the log:

homebridge.log.txt

ebaauw commented 3 years ago

Looks like the HomeMatic plugin installs its own SIGTERM signal handler, replacing the Homebridge signal handler. It should do its cleanup on the Homebridge shutdown event instead. Because of this, the shutdown event isn't issued, so none of the other plugins can do a proper shutdown. It might even cause issues with the cachedAccessories not being flushed.

[12/7/2020, 12:37:08 PM] [Homebridge UI] Homebridge restart request received
[12/7/2020, 12:37:09 PM] [Homebridge UI] No restart command defined, killing process...
[12/7/2020, 12:37:09 PM] [HB Supervisor] Stopping services...
[12/7/2020, 12:37:09 PM] Got SIGTERM, shutting down Homebridge...
[12/7/2020, 12:37:09 PM] [Harmony] INFO - shutdown
[12/7/2020, 12:37:09 PM] [Apple TV Platform] Shutting down Apple TV clients...
[12/7/2020, 12:37:09 PM] [HomeMatic CCU3] [RPC] Removing Event Server for Interface BidCos-RF.
[12/7/2020, 12:37:09 PM] [HomeMatic CCU3] [RPC] Removing Event Server for Interface BidCos-Wired.
[12/7/2020, 12:37:09 PM] [HomeMatic CCU3] [RPC] Removing Event Server for Interface HmIP-RF.
[12/7/2020, 12:37:09 PM] [Sonos] goodbye
[12/7/2020, 12:37:09 PM] [Hue] goodbye
[12/7/2020, 12:37:09 PM] [HB Supervisor] Homebridge Process Ended. Code: 0, Signal: null
MikeDeltaHH commented 3 years ago

Oh... ok... not so good... so i have to do a manual remove of the callbacks, need the HomeMatic Plugin! Thanks for your support and the very good plugin!

ebaauw commented 3 years ago

You could file an issue with the HomeMatic plugin. And in the meantime run HomeMatic in a separate Homebridge instance.

The "callbacks" (subscriptions) for Sonos are also not cleaned up, but they support more than 3 and expire automatically, so you're less likely to notice.

MikeDeltaHH commented 3 years ago

Ok, thanks for information, will do that! 👍