kind3r / hass-addons

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

Lock cannot communicate with my Raspberry Pi 4 when door is closed #22

Closed dibyadip-das closed 2 years ago

dibyadip-das commented 2 years ago

The door lock cannot communicate with my Raspberry Pi 4 when the door is closed. Does this seem to be a connectivity problem? Although RSSI remains at -64dB

drawing

Here are the logs:

Monitor started
noble: unknown peripheral undefined RSSI update!
noble warning: unknown handle 11 disconnected!
Monitor stopped
noble: unknown peripheral undefined RSSI update!
noble warning: unknown handle 11 disconnected!
noble: unknown peripheral undefined RSSI update!
noble warning: unknown handle 11 disconnected!
Peripheral connect start
Peripheral connect triggered
Peripheral connect error: Error: connection canceled!
    at Peripheral.cancelConnect (/app/node_modules/@abandonware/noble/lib/peripheral.js:61:26)
    at NobleDevice.connect (/app/node_modules/ttlock-sdk-js/dist/scanner/noble/NobleDevice.js:91:37)
    at async TTBluetoothDevice.connect (/app/node_modules/ttlock-sdk-js/dist/device/TTBluetoothDevice.js:47:17)
    at async TTLock.connect (/app/node_modules/ttlock-sdk-js/dist/device/TTLock.js:53:27)
    at async Manager._connectLock (/app/src/manager.js:583:21)
    at async Manager.unlockLock (/app/src/manager.js:187:13)
Connect failed
Lock connect failed
Connect to lock failed F7:7A:64:56:2E:82
Peripheral connect triggered
Peripheral connect start
Peripheral connect triggered
Peripheral connect error: Error: connection canceled!
    at Peripheral.cancelConnect (/app/node_modules/@abandonware/noble/lib/peripheral.js:61:26)
    at NobleDevice.connect (/app/node_modules/ttlock-sdk-js/dist/scanner/noble/NobleDevice.js:91:37)
    at async TTBluetoothDevice.connect (/app/node_modules/ttlock-sdk-js/dist/device/TTBluetoothDevice.js:47:17)
    at async TTLock.connect (/app/node_modules/ttlock-sdk-js/dist/device/TTLock.js:53:27)
    at async Manager._connectLock (/app/src/manager.js:583:21)
    at async Manager.unlockLock (/app/src/manager.js:187:13)
    at async WebSocket.<anonymous> (/app/api/index.js:78:30)
Connect failed
Lock connect failed
Connect to lock failed F7:7A:64:56:2E:82
Peripheral connect triggered
noble: unknown peripheral undefined RSSI update!
noble warning: unknown handle 11 disconnected!
noble: unknown peripheral undefined RSSI update!

I am aware of the esp32 gateway option but at the current time, the instructions are too complex for me to execute. I will try out all the alternatives

Fusseldieb commented 2 years ago

Just because the RSSI is decent, doesn't mean the signal reliability is good too.

Those locks seem very picky about the data they receive and their radio in general isn't that good either.

Also, be noted that the antenna on the Pi 4 isn't that good too, for example. See: https://www.raspberrypi.org/forums/viewtopic.php?t=260594 I guess it's probably interference from the board itself.

What I would do is try and purchase a brand Bluetooth Dongle (like Asus or whatever), a 1M USB extension cable (to get the dongle away from the board and interference) and try again, if possible. Try to get one that has a) Linux/Debian support and b) Good range

dibyadip-das commented 2 years ago

Thanks for the suggestion. Yes, I already ordered one and will post the results here as soon as I get up and running.

dibyadip-das commented 2 years ago

In case I restart the Addon. Do we lose pairing with the lock? I just did it and the lock seems to be no more paired?

dibyadip-das commented 2 years ago

As suggested by @Fusseldieb I was able to get a better connection using an external bluetooth dongle strategically located somewhere away from the interface of the PI using an usb extension cable.

Fusseldieb commented 2 years ago

Nice to know that this was in fact the problem!

Thank you for the issue report and I hope you the best :)