Open MarkGardiner opened 3 years ago
I don't see anything particulary wrong in the logs, except for the usual random CRC errors and that there is no unlock command send (just reading the logs, which it does at startup in general).
First try to restart the addon, let it settle for about 1 min (look at the logs, it should report it's connecting to a known lock to read it's current data), note the last line in the log (should be the disconnected from lock) and then try the unlock from UI. That should be the relevant log.
What I have noticed tho is the firmware version that is rather old (4.3.3 from 2019). You might wanna try pairing with the official app and update (I have 5.1.0 from 2020 on mine). Also, your lock does not seem to have CARD and Fingerprint reader. Could you post a link to the model ?
Thank you!
Following your steps (after restart the second line below is the disconnect. The following appeard after trying to 'unlock' which was stuck on grey after pressing. Going back to the screen it was blue but pressing it again, it would instantly turn blue and not attempt to load as such (let me know if you would like a har trace or something if it would be useful).
========= get OperationLog 7
Disconnected from lock F8:08:70:XX:XX:XX
Connect allready in progress
Connect to lock failed F8:08:70:XX:XX:XX
Connect allready in progress
Connect to lock failed F8:08:70:XX:XX:XX
Connect allready in progress
Connect to lock failed F8:08:70:XX:XX:XX
Connect allready in progress
....
I am not sure if this will give any more insight. Below is a fresh reset, pair and attempt to set a code. Once an action like this is attempted, parts of the UI wont load and it seems unresponsive. Restarting the addon doesn't seem to do much. MQTT logs are full of:
1634555093: Socket error on client
, disconnecting. 1634555112: New connection from 172.30.32.2 on port 1883. 1634555112: Socket error on client , disconnecting. 1634555213: New connection from 172.30.32.1 on port 1883.
TTLock addon logs:
[Error: ENOENT: no such file or directory, access '/data/aliasData.json'] { errno: -2, code: 'ENOENT', syscall: 'access', path: '/data/aliasData.json' } MQTT connected Monitor started Server started Monitor stopped BLE Scan started Discovered new lock: {"id":"f80870xxxxxx","manufacturer":"unknown","model":"unknown","hardware":"unknown","firmware":"unknown","address":"F8:08:70:XX:XX:XX","rssi":-54,"protocolType":5,"protocolVersion":3,"scene":2,"groupId":0,"orgId":0,"lockType":5,"isTouch":true,"isUnlock":false,"hasEvents":false,"isSettingMode":true,"txPowerLevel":0,"batteryCapacity":100,"date":0,"isWristband":false,"isRoomLock":true,"isSafeLock":false,"isBicycleLock":false,"isLockcar":false,"isGlassLock":false,"isPadLock":false,"isCyLinder":false,"isRemoteControlDevice":false,"isDfuMode":false,"isNoLockService":false,"remoteUnlockSwitch":0,"disconnectStatus":0,"parkStatus":0,"lockSound":-1,"autoLockTime":-1,"privateData":{},"operationLog":[]} New lock found, stopping scan BLE Scan stopped Refreshing paired locks Monitor started Monitor stopped Peripheral connect start Peripheral connect triggered Peripheral state: connected Device emiting connected BLE Device reading basic info BLE Device discover services start BLE Device discover services end BLE Device read characteristics start BLE Device read characteristics end BLE Device read characteristics start BLE Device read characteristics end BLE Device read basic info BLE Device subscribed Lock waiting for connection to be completed ========= init ========= init ========= AES key ========= AES key: 5bac00990c4XXXXXXXXXXXX ========= admin Setting adminPs XXXXXX and unlockKey XXXXXXX ========= admin: { adminPs: XXXXXXX, unlockKey: XXXXXXXX } ========= time ========= time ========= feature list <Buffer 64 00 04 f1 f1> ========= feature list Set(11) { 0, 4, 5, 6, 7, 8, 12, 13, 14, 15, 18 } ========= lockSound ========= lockSound: 1 ========= autoLockTime ========= autoLockTime: 0 ========= getAdminCode ========= getAdminCode ========= set adminPasscode Generated adminPasscode: XXXXXX SetAdminKeyboardPwdCommand received: <Buffer 64> ========= set adminPasscode: XXXXXX ========= remoteUnlock ========= remoteUnlock: 0 ========= finished ========= finished ========= device info Bad CRC should be 137 and we got 12 Bad CRC should be 137 and we got 12 Bad CRC should be 137 and we got 12 ========= device info: { featureValue: '', modelNum: 'SN138-AOEL_PV53', hardwareRevision: '1.2', firmwareRevision: '4.3.3.190429', nbNodeId: '', nbOperator: '', nbCardNumber: '', nbRssi: -1, factoryDate: '20190626', lockClock: '' } ========= check admin ========= check admin: 57054 ========= check random ========= check random ========= autoLockTime ========= autoLockTime: 0 ========= get passCodes 0 ========= get passCodes { sequence: -1, data: [] } Disconnected from lock F8:08:70:XX:XX:XX Connect allready in progress Connect to lock failed F8:08:70:XX:XX:XX Connect allready in progress Connect to lock failed F8:08:70:XX:XX:XX Connect allready in progress Connect to lock failed F8:08:70:XX:XX:XX Connect allready in progress Connect to lock failed F8:08:70:XX:XX:XX Connect allready in progress Connect to lock failed F8:08:70:XX:XX:XX Connect allready in progress Connect to lock failed F8:08:70:XX:XX:XX Connect allready in progress Connect to lock failed F8:08:70:XX:XX:XX Connect allready in progress Connect to lock failed F8:08:70:XX:XX:XX Connect allready in progress Connect to lock failed F8:08:70:XX:XX:XX
As for updating the firmware, the iphone app reports 'No updates' and version 4.3.3.190429. Visually, the lock I have is: https://ttlock.com.ua/shop/ttlock-rent/ (ttlock rent?). It doesn't have a card or fingerprint reader.
I received my lock yesterday and I'm havind the exact same issue as discribed, I've paired with a phone and upgraded the firmware as instructed to 5.1 (I'm on android) But after a factory reset the lock pairs with the raspberry, but this is the only command I can give, the addon fails to read any credential, change any settings or even unpair it. My log is the following:
ttlock-hass-integration@0.2.1 start node ./index.js MQTT connected Monitor started Server started Discovered paired lock: D8:D9:AE:75:8B:AE Monitor stopped Peripheral connect start Peripheral connect triggered Peripheral state: connected Device emiting connected BLE Device reading basic info BLE Device discover services start BLE Device discover services end BLE Device read characteristics start BLE Device read characteristics end BLE Device read characteristics start BLE Device read characteristics end BLE Device read basic info BLE Device subscribed Connected to known lock, reading general data ========= feature list Lock waiting for connection to be completed <Buffer 55 2c 4c d1 f7> ========= feature list Set(15) { 0, 1, 2, 4, 5, 6, 7, 8, 12, 14, 15, 18, 19, 22, 29 } ========= check admin ========= check admin: 56186 ========= check random ========= check random ========= autoLockTime Bad CRC should be 201 and we got 122 Bad CRC should be 201 and we got 122 Bad CRC should be 201 and we got 122 ========= autoLockTime: 1 ========= lockSound ========= lockSound: 1 Connected to paired lock D8:D9:AE:75:8B:AE Successful connect attempt to paired lock D8:D9:AE:75:8B:AE ========= get OperationLog 65535 ========= get OperationLog 65535 ========= get OperationLog 65535 Disconnected from lock D8:D9:AE:75:8B:AE
And when I try to do anything:
Connect allready in progress Connect to lock failed D8:D9:AE:75:8B:AE Connect allready in progress Connect to lock failed D8:D9:AE:75:8B:AE
I re-did the steps with the debug flags enabled. After the first disconnect, the log just repeats the "Connect allready in progress" messages.
Interestingly, I was able to reset, pair and send an unlock command quickly at one point. I am not sure how the handshake and protocol works but is it possible it'll work until the first disconnect? It feels like the software side is getting into a state where it isn't prepared to attempt sending?
There are lots of quirks in the BLE api (noble) that I had to work around, especially around the connect and disconnect which don't have a builtin timeout etc. Also the lock sometimes behaves haotically, it mostly has a timeout about 8s of idle and then closes connections, but this does not always happen and it closes connection during active communication.
I chose noble because it is cross platform compatible, at least in theory because some behaviours are actually different between various OSes. I will try to look again in the near future for other BLE implementations in node maybe there is something better, maybe linux only.
In my experience, using an ESP32 as a BLE gateway proved to be very reliable with more range (I have a module with an external antena) so maybe you want to give that a try until I find some time to look more into the current issue.
Well, the door lock is installed, but I have an ESP32 WROVER with an external antenna (gateway homing back to the cloud all the time was never an option, my IOT rule is local or die, net goes down but everything is still up). As soon as it arives, I will test it.
@brunosalezze - did you have any luck with a BLE gateway? If so I may try the same and get my head around setting up an ESP32.
I flashed an ESP32 gateway but I cannot get the gateway to find the lock. https://github.com/kind3r/esp32-ble-gateway/issues/2#issuecomment-998510676
Having the same issue... I'd be happy to assist in debugging if it can be managed somehow. I have HA running in under KVM on an Ubuntu 20 machine.
My lock has firmware 5.1.200320, no updates available when paired with official app.
Like others are reporting, pairing is OK, but no other operation works. I get error message: Connect allready in progress
Below log is from server restart followed by an attempt to save settings:
IGNORE CRC TRUE
Debug communication ON
> ttlock-hass-integration@0.2.1 start
> node ./index.js
MQTT connected
Monitor started
Discovered paired lock: D4:39:49:D6:A4:7A
Monitor stopped
Peripheral connect start
Server started
Peripheral connect triggered
Peripheral state: connected
Device emiting connected
BLE Device reading basic info
BLE Device discover services start
BLE Device discover services end
BLE Device read characteristics start
BLE Device read characteristics end
BLE Device read characteristics start
BLE Device read characteristics end
BLE Device read basic info
BLE Device subscribed
Connected to known lock, reading general data
========= feature list
Sending command: 7f5a0503010001000101aa001c0d0a
Lock waiting for connection to be completed
Received response: 7f5a050302000a002254aa103ea4bffddd9a325e5c57a2589208a0c57a0d0a
Command: 64344cd1f7
<Buffer 64 34 4c d1 f7>
========= feature list Set(16) { 0, 1, 2, 4, 5, 6, 7, 8, 12, 14, 15, 18, 19, 22, 28, 29 }
========= check admin
Sending command: 7f5a0503010001000141aa10999654050bdc0d7a8406cc051d050ae3150d0a
Received response: 7f5a050302000a002254aa10119c0dc3122c0be64d0caef2e0719789c50d0a
Bad CRC should be 8 and we got 197
Command: 000063d2
========= check admin: 25554
========= check random
Sending command: 7f5a0503010001000130aa10b173031c39cdcb545df86a3a29a3cee3230d0a
Received response: 7f5a050302000a002254aa103c91574436208cd41258e39abc5ee517080d0a
Command: 64
========= check random
========= autoLockTime
Sending command: 7f5a0503010001000136aa1056d696acf03a377dff7af39bd517cf0b5e0d0a
Received response: 7f5a050302000a002254aa103ce00ba816151803490574c73bda8671c30d0a
Command: 6401000500050384
========= autoLockTime: 5
========= lockSound
Sending command: 7f5a0503010001000162aa1056d696acf03a377dff7af39bd517cf0ba00d0a
Received response: 7f5a050302000a002254aa104228f8011225b9a71a2c219f2b363433480d0a
Command: 640101
========= lockSound: 1
Connected to paired lock D4:39:49:D6:A4:7A
Successful connect attempt to paired lock D4:39:49:D6:A4:7A
Disconnected from lock D4:39:49:D6:A4:7A
Connect allready in progress
Connect to lock failed D4:39:49:D6:A4:7A
Hello,
Thank you so much for this project, was over the moon when I saw all you have done.
I have managed to pair my lock but cannot seem to get any functions to work. The UI also seems to become unresponsive (some screens don't load) after I attempt any actions. Here is my log for a an unlock action:
`IGNORE CRC TRUE Debug communication ON Debug MQTT Debug gateway
What am I missing?