Lockitron Community

Lock Unlock API does not work a lot of times


#1

Hello,
I just installed the bolt and the bridge. Everything works fine using the Lockitron App. However the lock / unlock functionality using the API does not work. Here is a sample CURL. (Note: I have removed the actual lockID and appAccessToken from the CURL example below.) My bolt batteries % is greater than 80%

Any guidance will be appreciated.

curl -X PUT
'https://api.lockitron.com/v2/locks/:lockID?access_token=:appAccessToken
-H ‘cache-control: no-cache’
-H ‘content-type: application/json’
-d ‘{
“state”: “lock”
}’

Result:
Response Code: 500
Response:

{
“status”: “error”,
“message”: “This command failed and the batteries on this Lockitron are reported as low.”
}


#2

@aapte Hey there. I wouldn’t worry so much about the message on battery. I think it’s part of the generic failure message.

Assuming you’ve copied and pasted directly in to here, I think I see where the issue is. You’ve added some colons to the command just before Lock ID and Access Token.

It should be:
https://api.lockitron.com/v2/locks/lockID?access_token=appAccessToken

If that isn’t the issue, I’d try making it a one line statement. You can use my cURL Guide for reference. In my examples, I don’t have the state command split up like you do.

If you’re still having issues after that, perhaps something is keeping the Bluetooth connection open to a device. You can try temporarily disabling Bluetooth on any phones you may have connected.

Hope this helps!


#3

@anthonylavado

  1. :slight_smile: No the issue is not with the ‘:’ in my CURL. I have just put ‘:lockID’ and ‘:appAccessToken’ to denote the part I am replacing with the actual content.
  2. Also I do not think single line or multi line CURL makes a difference.

There is some issue with the API and not the Lockitron App.

AJ


#4

@aapte I just ran the one liner on my server, and got a successful lock/unlock with my real Lockitron unit.

Unfortunately I don’t have a really good way to redact the screenshot, otherwise I would post it. The API is central to using services like HomeBridge and Home Assistant, so I’m sure we would have heard much more if they weren’t working.


#5

Perhaps this will do - it’s the most I could get after cropping out the ID:

If you disabled Bluetooth on your phone, does the lock respond? If so, the Bridge + API access are both working. The Lockitron App only does something “special” when using Bluetooth. Otherwise, they use the same API we have access to.


#6

@anthonylavado thanks for the help. So I should have made it clear. Its not like the API is not working a 100%. I do get success responses every now and then. But a lot of times yesterday I was getting that error which felt like a timeout. Going to try the API for a few more days and then report back the failure rate.


#7

I wonder if your Bridge has a tenuous Bluetooth connection or wifi connection? Check your bridge diagnostics to see what it reports for signal levels. Also, does the app reliably work when not connected via Bluetooth?