After I deleted my lock from ttlock app, it can be paired and the addons was successfully added to ha as mqtt lock.
The webui is also running smoothly, I have tried all the features in it. It works!
Moreover I can tell you that I always get notification update on the Home app (using homekit bridge addons) when I do locking/unlocking from ttlock webui. Which is great.
But it seems mqtt lock/unlock feature isn’t working in my case. I never got my lock was changing status when I update it from lovelace entity ui nor from the mqtt publish. The log was ok as I got mqtt_debug enabled.
Could you help me fix the problem?
I’ve been waiting for this such addons for quite some times, so thank you very much for the great works.
Btw, I have the G2 gateway, it’s definitely useless now
I just found out that the useless TTLock gateway can’t even remotely lock, it can only unlock remotely. So i’m looking into what you’ve done here as an alternative. And the useless gateway also emits a weird agressing sound, so i’m guessing I didn’t get a top notch hardware either
Am I right to say that currently, your addon is only working on a home-assistant device with wifi & bluetooth, and that device must be in the now-famous (thx covid) 2m range of the lock ?
I also understand that you are working on an ESP “firmware” to act as a gateway. This is what I would be most intesrested on, since my current homeassisant setup is a big headless ubuntu server downstairs
Thx for all your effort. If time permits, i’ll look into your stuff to maybe contribute, but I sure am very interested
Indeed, by default the addon runs on a system that has to have BLE adapter and the range is rather limited, but this can be overcome by installing an esp32 gateway. Setting up the gateway requires a bit of tinkering if you have never used the PlatformIO environment but it’s not overly complicated. The esp project is located here if you wanna give it a go https://github.com/kind3r/esp32-ble-gateway
I used a (terrible) hack to get the remote locking. Id call the autolock API with the minimum 5 seconds and then call unlock (obviously you’ll have a 5 second window of open) if youd like to use that in the interim!
I’m assuming you are reffering to the ESP32 gateway software.
Not really ready for this step yet for 2 main reasons:
It’s not stable enough for mainstream use mostly because memory is at the very limit. The PSRAM on the WROVER modules would help a lot but I’m trying to accomplish my goal of building a generic BLE gateway without using the extra RAM as those modules are not really common. I’m porting from Arduino to ESP-IDF to get more control on the resources used and hopefully save some RAM in the process. If all this fails, I will rewrite a stripped down version that will work exclusivelly with TTLock addon and be done with it.
I’m not familiar with binary distributions, especially due to the fact that the partitioning scheme is not standard and there is a data partition for the web UI. So I have to do some research into the process. Besides, VSCode and PlatformIO do a great job at installing all the dependencies required so it’s just a matter of adding your board to the platformio.ini file (or maybe not even).
On a different (and more exciting) topic, I got my gateway a couple of days ago and I’ve been able to figure out how it detects the fact that the lock was unlocked and send a notification. It’s not pretty but I got it working in the SDK. The main downside it that it requires a passive BLE scan which is not possible in the BLE library that I use (Noble) and an always running active scan could have battery life impact on the other BLE devices in range. For those interested you can follow the development on GitHub. It will require more testing before integrating this change it into HA as scanning can also impact interaction with other addons that use BLE.
For those following this thread, there is now a new version available that implements reading the operation log and update HA about lock/unlock events. Due to how this works expect a delay between the unlock event and the update in HA, this is the same way the official gateway detects this events and it’s a limitation of the lock protocol itself.
and could anyone suggest the brand of TTlock that was succesful in pairing it with hassio? i dont know if tuya ttlock will work. if not ill go with sciener ttlock.
Nice work on this, @kind3r ! I can almost use this integration… almost.
I own several hidden drawer TTLocks as well as a TTLock latch on my front door. All of these are currently controlled by the official TTLock app. I tried setting these up in HA using your integration. After some false starts, I believe I have all the key features working. But, unfortunately, this is not yet usable for me (or for most use-cases, I suspect).
Unfortunately, the limited bluetooth range is a deal breaker for me. Regardless of where I position my bluetooth enabled HA computer, the range is insufficient to connect to all the locks. Will definitely need a gateway in order to use this.
Do you know of any workarounds for the gateway for now?
@ChickenCoop if by workaround you mean not using a gateway then I’m not sure. A cheap ESP32 board and a leftover USB charger should get the job done setting up a gateway, but still, if the devices ar really far apart it would be difficult even for the ESP’s onboard antenna. Maybe a board with an external antenna would work better.
Another option would be an USB bluetooth BLE dongle with external antena.
A 3rd option, if you feel adventurous and use a PI, would be adding an external antenna to it, which I might just do as it seems easy enough for me.
Btw, you mentioned “HA computer”, what kind of computer are your talking about ? Does it have an external antenna for WiFi/bluetooth ?
I was under the impression that using a Bluetooth gateway was not (yet) compatible with your TTLock Integration. Is that not the case? If using a gateway is indeed an option, then perhaps an ESP32 is a good option.
I’m using an Odroid N2+ equipped with an Odroid USB Bluetooth Module 2. And I have the Bluetooth dongle connected using a USB cable to avoid interference as has been suggested on other threads. I believe this is considered a “class 2” bluetooth device, which means it has a range of about 10 meters. Perhaps I need to upgrade this to a “class 1” device, which should have something closer to a 100 meter range? If that’s an option, it would seem that using a gateway would be redundant.
It is not compatible with the official TTLock gateway, but I build a pseudo BLE gateway (think of it like a proxy/remote BLE adapter accessed via TCP/IP). It is working but at the very limit of ESP32’s RAM due to WiFi + BLE + websockets etc. I am working on a rewrite using pure ESP-IDF but I’m stuck as the current stable ESP-IDF release does not support some websocket features I need. I’m also considering other options in the long run like using an MQTT server for communication instead of websockets, but that would just add another dependency to the ecosystem (not relevant for HA users, but for having a general purpose BLE gateway which was my intention).
As for your BLE dongle, indeed, having such a small form factor module does not really help. ESP’s on board antena is larger than that whole module So yeah, I think getting a better module should help.
hi
i can’t find the file sdkconfig.h location, where i can find this path:
.platformio/packages/framework-arduinoespressif32/tools/sdk/include/config
?
and another question can’t we use bluetooth in raspberry pi 4 to connect to the lock ?
I’ve emailed the people at TTLock, asking them to consider making that possible, but haven’t heard anything yet.
These locks are amazing and could get massive traction in the smart home community, if they allowed integrations from the likes of Home Assistant, HomeKit and SmartThings.