kind3r / hass-addons

Integration of the offline TTLock sdk into Home Assistant
59 stars 21 forks source link

TTLock: add names for fingerprints #5

Closed justinlawrence closed 3 years ago

justinlawrence commented 3 years ago

Please could we allow adding a name for each fingerprint added, like they do in the TTLock app.

This would make it easy to know which items to remove when revoking access.

See screenshot below. Thanks!!

6C7AF180-07D7-4274-84DA-64065ACB71F3

kind3r commented 3 years ago

Hi @justinlawrence ,

I have added support for naming the cards and fingerprints, but I am unsure about the uniqueness of the fingerprint IDs between multiple locks. For the moment I globally associate the ID (card or fingerprint) with the name, instead of doing it per lock. For cards it's a good thing as the same card has the same ID on all locks (it's actually the card's serial number) so you can rename it once and it will show up with the same name everywhere. But I'm uncertain how the locks assigns IDs to fingerprints. For sure they can't be unique (same finger to have the same ID on multiple locks) but I'm worried that they could be assigned in sequence somehow, unless it's just a hash of the fingerprint data in which case there's no issue.

So, could you please check if fingerprints IDs are unique across your locks ? If you find the same ID then I will need to include the lock address in the data to keep fingerprint names associated to that particular lock.

justinlawrence commented 3 years ago

Hey @kind3r, wow— that was quick! Thank you.

Unfortunately I only have one of these locks, though will consider getting another in the next few months, especially if fingerprints may work on both.

I’ll test the fingerprint naming as soon as the changes are live (or I can update via some other channel to help test, if needed)

kind3r commented 3 years ago

Ah, ok, for some reason I thought you had multiple locks, confused from another thread :D

You can update by going to the Supervisor section -> Add-on Store -> the 3 dots on the top right -> Reload. This will refresh the versions for all your addons. After that, the TTLock addon should show update available.

justinlawrence commented 3 years ago

They worked really well thanks, with 2 small issues:

  1. I was unable to remove the bottom-most entry from the fingerprint list. (I was trying to remove the old ones without aliases).
  2. When adding a new fingerprint, it intermittently showed me the previous fingerprint alias I had added in the dialog (making me wonder whether I was editing the previous one or adding a new one). I also noticed the cursor went missing when this happened.

I hope this feedback is granular enough.

Thanks!

kind3r commented 3 years ago

Hi @justinlawrence , I was not able reproduce the bugs you mentioned, but for (2) I have an ideea what could go wrong and I have corrected (now add dialog should always be cleared of old values).

There are still issues during communication with the lock which can cause some random stuff, I have to figure out a better way of handling them. The credentials fetching is quite a long series of commands which as you noticed takes quite some time. During this sequence sometimes the lock decides to disconnect, or respond with an error. I am now considering 2 ways of approaching this:

  1. Split into separate pin/card/finger pages so that only the required credentials are requested to keep the communication short.
  2. Investigate if authentication is really required before each credential fetch, this would save a lot of BLE air time (and battery).

I will close this issue for now, but please feel free to keep the dialog open.

justinlawrence commented 3 years ago

Sounds great, thanks @kind3r!