SwitchBotAPI icon indicating copy to clipboard operation
SwitchBotAPI copied to clipboard

Lockoing/unlocking Lock pro via API is not working

Open ric-101 opened this issue 1 year ago • 10 comments

Lock Pro API 400 Error for no apparent reason

Hi there!

So I'm trying to control my SwitchBot Lock Pro via API (through the hub, of course).

I can correctly connect to the hub, and query the Lock Pro via API (get status of the LockPro), but as I try to Lock/Unlock it I keep getting an error.

  • Authorization seems fine (I get "unathorized" error if the token expires or I remove the header, but works as soon as I add it properly),
  • the payload seems fine ( {"command": "lock"} - if I change the value to a random string, I get "not this command" error, which I do not get with the correct command, "lock")

But when I try and run it, I get the following error: "One or more parameter values are not valid. The AttributeValue for a key attribute cannot contain an empty string value. Key: sn" - but I have no clue what "sn" is nor where it should be (I tried added it in the payload and the header, with no success).

Attached is a screenshot of my (python) code, and the result when trying to run it:

image

Anyone can help?

Thank you!!

Logs

b'{"statusCode":400,"body":{},"message":"One or more parameter values are not valid. The AttributeValue for a key attribute cannot contain an empty string value. Key: sn"}'

Configuration

noting useful

Environment

  • OS: Win 11

Additional Context

No response

ric-101 avatar Jun 21 '24 21:06 ric-101