bwitting / homebridge-ttlock

Homebridge plugin for the TTLock Platform
Apache License 2.0
13 stars 5 forks source link

Gateway busy #2

Closed cemilbrowne closed 1 year ago

cemilbrowne commented 2 years ago

Howdy, thanks for creating this plugin - I got it setup (not without a bit of messing about with the username/password!), but am having issues with auto-lock.

[8/22/2022, 3:03:23 PM] [TTLock] Basement Door unlocked successfully.
[8/22/2022, 3:07:14 PM] [TTLock] locking of Basement Door failed. The gateway is currently busy.

In this setup, I unlocked via homekit, the lock auto-locked itself, but still reported status = unlocked in homekit. When I then tried to lock (via homekit), I got the message above (locking failed).

Both the error message & status are currently incorrect. Lock stays in "locking" mode indefinitely in HK.

bwitting commented 2 years ago

Hmm, interesting. With that error, the TTLock API is returning code 3003, which means the gateway is busy and is refusing the request. Their documentation doesn't have a whole lot of info about what that actually means, but in my testing, if I lock/unlock the app (using the remote gateway, not Bluetooth) and try to send a Homekit request at the same time, I get that error. But then if I try again in 10 seconds or so it seems to work fine.

So it sounds like the plugin is able to contact the gateway, but the gateway is busy or can't communicate correctly with the lock.

Here's what I can think of asking to troubleshoot:

  1. What Gateway and lock are you using?
  2. Is the gateway set up and showing "Online" in the TTLock app?
  3. Is the lock associated with the Gateway in the lock settings of the TTLock app?
  4. If you use the little "Unlock Remotely" button in the app, does that work? (From what I can tell, that will force it to use the gateway and not Bluetooth)
  5. How close is the gateway to the lock? Mine is about 6 feet away and it still says the signal strength is medium.
cemilbrowne commented 2 years ago

Great troubleshooting tips - I'll do some more when I get a chance. One note: I don't see a debug option in the TTLock settings - is there a specific item I should turn on for more debug logging?

I'm using a Gateway v G2; gateway does show online and is associated. Remote unlock does appear to work - and the gateway is within 2 meters (6 feet) as well.

I'll keep debugging this one. Getting a really solid ttlock homebridge platform would be great.

stalkerj commented 1 year ago

Hello. I also got this error about gateway. When i made username in CMD i couln't enter second part of command. Here is I got:

C:\Windows\System32>curl --ssl-no-revoke --location --request POST "https://euapi.ttlock.com/v3/user/register?clientId=xxxxxxxxxxx&clientSecret=xxxxxxxxxxxxx&username=Anton&password=xxxxxxxxx&date=CURRENTMILLIS" \ {"username":"ccecg_Anton"}curl: (6) Could not resolve host: \

C:\Windows\System32>--header "Content-Type: application/x-www-form-urlencoded" \

What did I make wrong?

dale-tectorsolutions commented 1 year ago

stalkerj It looks like it's running that command as two separate commands. Try to copy this and paste into CMD:

curl --ssl-no-revoke --location --request POST 'https://euapi.ttlock.com/v3/user/register?clientId=[clientid]&clientSecret=[clientsecret]&username=[username]&password=[passwordasmd5]&date=CURRENTMILLIS' \ --header 'Content-Type: application/x-www-form-urlencoded' \

fmp777 commented 1 year ago

When I got this "gateway busy" error - i power cycled the gateway, and everything came back online. Hope that doesn't happen so often, but just adding my experience here.