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

Remove smartlock from the plugin after replacement #110

Closed
tobihoby opened this issue Jun 5, 2023 · 10 comments
Closed

Remove smartlock from the plugin after replacement #110

tobihoby opened this issue Jun 5, 2023 · 10 comments
Labels
enhancement New feature or request

Comments

@tobihoby
Copy link

tobihoby commented Jun 5, 2023

Hi,

I had to remove one of my two smartlocks due to a defect and replace it with a new one. Unfortunately, the smartlock that was already removed in the Nuki Bridge is apparently still found during autodiscover. how can i permanently delete it from homebridge configuration? I have already emptied the cache in HB.

[5.6.2023, 14:29:02] [Nuki] Nuki Garagentür: Nuki Smart Lock 3.0 v3.4.10
[5.6.2023, 14:29:02] [Nuki] Nuki Garagentür: Nuki Smart Lock 3.0 v3.6.9

Thank you.

Best regards
Tobi

@ebaauw
Copy link
Owner

ebaauw commented Jun 5, 2023

You need to delete it from the Nuki bridge. Homebridge NB should delete it from the Homebridge cachedAccessories when the bridge no longer exposes it. You can double-check with nb list that the bridge is still exposing it.

@ebaauw ebaauw added the question Further information is requested label Jun 5, 2023
@tobihoby
Copy link
Author

tobihoby commented Jun 5, 2023

The old SmartLock has already been deleted in the Nuki Bridge. nb list no longer shows me the old SmartLock either. I assume it's still in the cache somewhere?!

@tobihoby
Copy link
Author

tobihoby commented Jun 5, 2023

homebridge@HB38:/var/lib/homebridge $ nb -H 192.168.0.236 -T xxxxxxxx list
[
{
"deviceType": 0,
"firmwareVersion": "2.14.5",
"lastKnownState": {
"batteryChargeState": 32,
"batteryCharging": false,
"batteryCritical": false,
"doorsensorState": 2,
"doorsensorStateName": "door closed",
"keypadBatteryCritical": false,
"mode": 2,
"state": 3,
"stateName": "unlocked",
"timestamp": "2023-06-05T15:13:08+00:00"
},
"name": "Zuhause",
"nukiId": xxxxxxxxxxxxxxxx
},
{
"deviceType": 4,
"firmwareVersion": "3.6.9",
"lastKnownState": {
"batteryChargeState": 48,
"batteryCharging": false,
"batteryCritical": false,
"mode": 2,
"state": 3,
"stateName": "unlocked",
"timestamp": "2023-06-05T13:41:25+00:00"
},
"name": "Nuki Garagentür",
"nukiId": xxxxxxxxxxxx
}
]

@tobihoby
Copy link
Author

tobihoby commented Jun 5, 2023

Does it make sense to delete the accessories folder?
What is better not to delete in this folder?

pi@HB38:/var/lib/homebridge/accessories $ ls -l -t
insgesamt 648
-rw-r--r-- 1 homebridge homebridge 145401 5. Jun 18:49 cachedAccessories.0EABD69178BF
-rw-r--r-- 1 homebridge homebridge 118108 5. Jun 18:20 cachedAccessories.0E7B6FA5392E
-rw-r--r-- 1 homebridge homebridge 127083 5. Jun 18:20 cachedAccessories.0EB2875E6FE2
-rw-r--r-- 1 homebridge homebridge 7180 5. Jun 15:31 uiAccessoriesLayout.json
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:20 cachedAccessories.0E79596844EA
-rw-r--r-- 1 homebridge homebridge 10992 5. Jun 14:20 cachedAccessories.0EF3C9B51F82
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:19 cachedAccessories_20230605_182744.bak
-rw-r--r-- 1 homebridge homebridge 22322 5. Jun 14:17 cachedAccessories.0E467267A8D2
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:17 cachedAccessories.0EC21E4281BD
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:17 cachedAccessories.0EF8DB7D92DF
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:17 cachedAccessories.0E9D9B15C95E
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:17 cachedAccessories.0E941AAD9168
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:17 cachedAccessories.0EAD478A3ECB
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:17 cachedAccessories.0EA654A076D6
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:17 cachedAccessories.0EEE5AB88290
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:17 cachedAccessories.0EA0C20BE244
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:17 cachedAccessories.0E2F49E27B73
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:17 cachedAccessories.0E2AE1EAB51D
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:17 cachedAccessories.0ED037B65104
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:17 cachedAccessories.0EF58DAF9913
-rw-r--r-- 1 homebridge homebridge 13550 5. Jun 14:17 cachedAccessories.0EFC46E063A1
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:17 cachedAccessories.0EA22590A965
-rw-r--r-- 1 homebridge homebridge 10175 5. Jun 14:17 cachedAccessories.0E7C8BA694F9
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:17 cachedAccessories.0EBE9667186B
-rw-r--r-- 1 homebridge homebridge 3 5. Jun 14:17 cachedAccessories.0E46EE00C85A
-rw-r--r-- 1 homebridge homebridge 3 29. Jan 21:33 cachedAccessories.0E457FB5E4CC
-rw-r--r-- 1 homebridge homebridge 22304 6. Jan 19:11 cachedAccessories.0E50A4C66B25
-rw-r--r-- 1 homebridge homebridge 22321 6. Jan 18:35 cachedAccessories.0EDD1754A2B3
-rw-r--r-- 1 homebridge homebridge 3 29. Dez 06:59 cachedAccessories.0E7B1124CAFC
-rw-r--r-- 1 homebridge homebridge 3 29. Dez 06:59 cachedAccessories.0ED0D6E637D3
-rw-r--r-- 1 homebridge homebridge 3 28. Dez 16:19 cachedAccessories.0E350BD1F779
-rw-r--r-- 1 homebridge homebridge 3 28. Dez 16:19 cachedAccessories.0EB1184336C8
-rw-r--r-- 1 homebridge homebridge 3 28. Dez 16:19 cachedAccessories.0E4455986EDE
-rw-r--r-- 1 homebridge homebridge 3 28. Dez 16:19 cachedAccessories.0EF4A7C17AE4
-rw-r--r-- 1 homebridge homebridge 3 28. Dez 16:19 cachedAccessories.0E886991D014
-rw-r--r-- 1 homebridge homebridge 3 28. Dez 16:19 cachedAccessories.0E8D961D30D4
-rw-r--r-- 1 homebridge homebridge 3 28. Dez 16:19 cachedAccessories.0E172A99C441
-rw-r--r-- 1 homebridge homebridge 3 28. Dez 16:19 cachedAccessories.0E49D851D467
-rw-r--r-- 1 homebridge homebridge 3 28. Dez 16:19 cachedAccessories.0E3858122E79
-rw-r--r-- 1 homebridge homebridge 3 28. Dez 16:19 cachedAccessories.0ECE3042A6E5
-rw-r--r-- 1 homebridge homebridge 3 28. Dez 16:19 cachedAccessories.0E7773650545
-rw-r--r-- 1 homebridge homebridge 3 28. Dez 16:19 cachedAccessories.0E70247A14A4
-rw-r--r-- 1 homebridge homebridge 3 28. Dez 16:19 cachedAccessories.0E07E0BCDF4C
-rw-r--r-- 1 homebridge homebridge 3 28. Dez 16:19 cachedAccessories.0E9E6798B652
-rw-r--r-- 1 homebridge homebridge 3 28. Dez 16:19 cachedAccessories.0E9F1DAAF78B

@ebaauw
Copy link
Owner

ebaauw commented Jun 5, 2023

The old SmartLock has already been deleted in the Nuki Bridge. nb list no longer shows me the old SmartLock either. I assume it's still in the cache somewhere?!

Stupid question (sorry), but you did restart Homebridge NB after removing it from the Nuki bridge?

Does it make sense to delete the accessories folder?
What is better not to delete in this folder?

There is a cachedAccessories file per child bridge, matching the username of the child bridge. Looking at the timestamps, there seem to be a number of old files. I wouldn't recommend blindly deleting active files; HomeKit will likely lose any accessory associations with rooms, groups, scenes, and automations.

Does the old lock still show under Remove Single Cached Accessory (in the Homebridge Settings in the UI)? If so, you might try and remove it there.

@tobihoby
Copy link
Author

tobihoby commented Jun 6, 2023

Yes, of course I restarted the entire Homebridge and the entire server.
The SmartLock deleted in the Nuki Bridge was still included.

I have now deleted the appropriate cachedAccessories. As feared, the entire plugin config was then of course deleted, including my other SmartLock, which I actually wanted to avoid. Had to do the discovery again using the button on the Nuki Bridge.

The problem is solved, the old Smartlock is now gone.

Perhaps it would be possible to add an option to the plugin as a feature request in order to delete any devices that have been removed from the Nuki Bridge yourself or to carry out a new inventory.
A Smartlock can always break and then replacing it would be much easier.

Thanks anyway.

@ebaauw ebaauw added enhancement New feature or request and removed question Further information is requested labels Jun 6, 2023
@ebaauw
Copy link
Owner

ebaauw commented Jun 6, 2023

Yes, I thought I had done that already, but that must have been another plugin. Challenge is to test this. I have only one Nuki bridge, one smart lock, and one opener, which my family and I actually use for real.

@tobihoby
Copy link
Author

tobihoby commented Jun 7, 2023

I would appreciate if you could provide it as an option. Someone will certainly test it, because, as I have already written, the need will certainly be there.
Thanks very much.

@ebaauw
Copy link
Owner

ebaauw commented Jul 22, 2023

As feared, the entire plugin config was then of course deleted, including my other SmartLock, which I actually wanted to avoid.

You can delete individual accessories from cachedAccessories through the Homebridge UI.

@ebaauw ebaauw closed this as completed Jul 22, 2023
@ebaauw
Copy link
Owner

ebaauw commented Jul 28, 2023

v1.4.6 adds a removeStaleAccessories config.json setting, to remove stale accessories, that no longer have a corresponding device, exposed by a Nuki bridge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants