11.06.2026, 07:48
Modify as needed
Code:
local https = require("ssl.https")
local ltn12 = require("ltn12")
local clientId = "YOUR_CLIENT_ID"
local accessToken ="YOUR_TTLOCK_ACCESS_TOKEN"
local lockId = "YOUR_LOCKID"
local timestamp = tostring(os.time() * 1000)
local body = "clientId=" .. clientId ..
"&accessToken=" .. accessToken ..
"&lockId=" .. tostring(lockId) ..
"&date=" .. timestamp
local response = {}
local _, code = https.request{
url = "https://euapi.ttlock.com/v3/lock/unlock",
method = "POST",
headers = {
["Content-Type"] = "application/x-www-form-urlencoded",
["Content-Length"] = tostring(#body)
},
source = ltn12.source.string(body),
sink = ltn12.sink.table(response)
}
log("Unlock response (" .. tostring(code) .. "): " .. table.concat(response))