26.09.2025, 13:07
(26.09.2025, 12:58)admin Wrote: You are missing Content-Length header for the POST request.
Code:["Content-Length"] = #iData,
You should use json.encode instead of writing JSON manually to avoid potential errors.
Like this (but with same error)?
Code:
setData('thermostat/dhw/charge', {value = true})
function setData(iFunction, iData)
if iDebug then log(devUrl..iFunction) end
res, code = https.request({
url = devUrl..iFunction,
method = 'POST',
headers = {["Content-Type"] = "application/json",
["Content-Length"] = #iData
},
data = json.encode(iData)
})
if iDebug then
log(code, res)
end
return code, res
end