HASS Addon TTLock offline integration

Thank you for sharing this info. Are the 2 gateways connected to the same add-on, or each gateway is connected to an independent add-on? I am assuming these are ESP-32 based gateways, correct?
Thank you

Two gateways connected to the same addon.

No, these are two rpi zero w. If you manage to got the ESP version to build i would love to have some directions on how to do the same.
I posted a few weeks ago the steps on installing the gateway on a RPI. I used a pi w 2 because it’s what i had at hand, but others installed on the original pi zero w

How did you connect 2 gateways to same add on?

Changed the addon code. But didn’t have the time to test it yet

Could you please help me identify what might be causing the issue? I’m using the lock control without a gateway. Quite often, commands to unlock the lock, as well as to add codes, fingerprints, and other functions, either don’t work at all or have a significant delay.

I have the same problem and i believe the issue is low bluetooth signal.
keep an eye on the bluetooth signal level.
I have the gateway right by the lock and the signal is weak or simply fails.

If anybody who knows anything about bluetooth wants to chime in.

Bluetooth signal extremely weak even when the gateway is right next to the lock (20cm). But i have the TTLOCK official gateway that can read the lock on medium/low signal from 5.5 meters away.
There must be some weirdness going on there

Once again, it didn’t work. It hangs at the step marked in red.

I have connect errors but its signal issues.

in your case you have an extra error message: macro_adminLogin: Error: Failed checkRandom response

I never seen that.
Are your settings correct?

A few observations, sorry I have not returned here but have not had much time lately…

Bluetooth Signal
I did some tests for my scenario a few weeks ago (PiZero2W) and found a spot that was (surprisingly) acceptable. I did this by a temporary setup of PiZero2 connected to a small power bank and moving gateway around and measuring RSSI at certain spots for a period of time. Almost as an afterthought I tested in the next room (garage) close to where the old G2 Gateway was positioned and it worked fairly well ! I was surprised. While it is only about 2m from the lock, it is on the other side of a | plaster board | insulation | fibro cement | wall. This position also has a much better WIFI signal.
Hard to compare peoples different scenarios as it depends so much on interference, lock type, gateway etc, etc.

Lock DateTime
I was running the lock on some rechargeable AAAs and took them out last week to recharge for a few hours. On return, I found that the lock was reporting an event time hours different from the actual time. Not sure if this was causing some of the weird hit and miss errors. Anyway I found some code that references time sync operation but did not have the time(!) to investigate much… in the end a lock ‘init’ (re-pair) was done and you could see in the log a Time command of some sort was issued. Probably not an issue if you just swap batteries when changing. Something to keep in mind.

Passage Mode
I have managed to set ‘passage mode’ time periods which for my use case is great. The only issue is that the existing code for lock/unlock logic has no idea. So when an UNLOCK is performed, the code simply says 'If AutoLock is > 0 then mark the lock as LOCKED after the autolock time passes. (So no connection to a real lock event.) Still looking into this …

Direct Gateway commands
For my attempts at trying to understand how the lock works, I have been logging into the Gateway directly and using the provided examples directory in the SDK. Initially there were a number of errors but I have managed to crudely eliminate these. I have also added some timestamps to the console logging for easier understanding.
So for example running a STATUS I do this:

ttlock@TTLockG1:~/ttlock-sdk-js $ sudo node ./examples/status.js
12:00:16 |  12:00:15:: Scan started

12:00:16 |  Peripheral connect start
12:00:18 |  Peripheral connect triggered
12:00:18 |  Peripheral state: connected
12:00:18 |  Device emiting connected
12:00:18 |  BLE Device reading basic info
12:00:18 |  BLE Device discover services start
12:00:18 |  BLE Device discover services end
12:00:18 |  BLE Device read characteristics start
12:00:18 |  BLE Device read characteristics end
12:00:18 |  BLE Device read characteristics start
12:00:19 |  BLE Device read characteristics end
12:00:19 |  BLE Device read basic info
12:00:19 |  BLE Device subscribed
12:00:19 |  Connected to known lock, reading general data
12:00:19 |  ========= feature list
12:00:19 |  Lock waiting for connection to be completed
12:00:19 |  <Buffer 3b 34 4c d5 f7>
12:00:19 |  ========= feature list Set(17) { 0, 1, 2, 4, 5, 6, 7, 8, 10, 12, 14, 15, 18, 19, 22, 28, 29 }
12:00:19 |  ========= check admin
12:00:19 |  ========= check admin: 42959
12:00:19 |  ========= check random
12:00:19 |  ========= check random
12:00:19 |  ========= autoLockTime
12:00:19 |  ========= autoLockTime: 100
12:00:19 |  ========= lockSound
12:00:19 |  Bad CRC should be 164 and we got 23
12:00:19 |  Bad CRC should be 164 and we got 23
12:00:20 |  Bad CRC should be 164 and we got 23
12:00:20 |  ========= lockSound: 1

12:00:20 |  Trying to get lock/unlock STATUS
12:00:20 |  Lock is LOCKED     Code: 0

I have been woking my way through the provided examples and am finding I am getting much more reliable and consistent responses. Of course controlling/monitoring the lock from HAssistant is the name of the game. So in the end all I eventually want from HA is lock/unlock action and monitoring and battery status. But that’s just my case.

image

Lock signal history

I’ll have to be abroad for a while and wont be able to test this in the next few weeks.

If anybody wants to give it a go this is the repo with the changes for multiple gateways:

on the gateway ip field add a comma separated ip list (eg: 192.168.0.50,192.168.0.51,192.168.0.52)
all other settings are the same as normal.
I find it takes a few attempts for it to do anything, but i have the same behaviour with a single gateway anyway.

I’ll test it when i come back anyway.

If anybody decides to have a go at it, let us know the results.

I get the same error message
have you resolved this?

Thank you for the dtailed post
I am getting this error when trying to build the File System Image.
Any idea how I can reoslve this?
Thank you

Just curious when you were trying to build ESP32 gateway, did you encounter this error?

Building in release mode
Building FS image from ‘data’ directory to .pio\build\esp-wrover\spiffs.bin
/index.html.gz
SPIFFS_write error(-10001): File system is full.

error adding files!
*** [.pio\build\esp-wrover\spiffs.bin] Error 1

I’m not sure, i had all kinds of issues when trying the ESP32.
I might have had that issue when trying to use a ESP32 WROOM . It doesn’t have enough space.
It HAS to be a WROVER unless you work out some way to improve the code :slight_smile:

Also If you manage to create the ESP gateway don’t forget to come back and let us know what we need to do to create our own or share the bin so we can try to flash without having to build

npm ERR! code 1
npm ERR! path /home/mastersat/ttlock-sdk-js/node_modules/@abandonware/noble
npm ERR! command failed
npm ERR! command sh -c node-gyp-build
npm ERR! /home/mastersat/ttlock-sdk-js/node_modules/node-gyp/bin/node-gyp.js:81
npm ERR! const args = await prog.commandscommand.name ??
npm ERR! ^
npm ERR!
npm ERR! SyntaxError: Unexpected token ‘?’
npm ERR! at wrapSafe (internal/modules/cjs/loader.js:915:16)
npm ERR! at Module._compile (internal/modules/cjs/loader.js:963:27)
npm ERR! at Object.Module._extensions…js (internal/modules/cjs/loader.js:1027:10)
npm ERR! at Module.load (internal/modules/cjs/loader.js:863:32)
npm ERR! at Function.Module._load (internal/modules/cjs/loader.js:708:14)
npm ERR! at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
npm ERR! at internal/main/run_main_module.js:17:47

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2024-11-04T22_32_53_628Z-debug.log

I tried thr RPI but I am getting this error

I hope you can help with this issue please and thank you

I solved it a long time ago, now I don’t remember exactly how but I found some notes where I marked the steps to solve the problem:

  • to flash the filesystem image you must comment out the line (adding the # symbol) board_build.partitions = min_spiffs.csv located in the platformio.ini file

  • after flashing the system image, remove the comment (#) and flash with the upload and monitor command

p.s.: sorry if the english is not correct but I’m using a translator.
Let me know if you solve it

Thank you for your quick response.
I was able to upload file system image and upload the build
HOWEVER
when I connect to the AP and login with admin/admin the page is blank and no configuration options or anything available
any idea how to resolve this?
thank you

Thank you for your quick response.
I was able to upload file system image and upload the build
HOWEVER
when I connect to the AP and login with admin/admin the page is blank and no configuration options or anything available
any idea how to resolve this?
thank you