This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Control Nefit boiler
#3
(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
Reply


Messages In This Thread
Control Nefit boiler - by gjniewenhuijse - 26.09.2025, 12:53
RE: Control Nefit boiler - by admin - 26.09.2025, 12:58
RE: Control Nefit boiler - by gjniewenhuijse - 26.09.2025, 13:07
RE: Control Nefit boiler - by admin - 26.09.2025, 13:13
RE: Control Nefit boiler - by gjniewenhuijse - 26.09.2025, 13:20
RE: Control Nefit boiler - by admin - 26.09.2025, 13:27
RE: Control Nefit boiler - by gjniewenhuijse - 26.09.2025, 13:33
RE: Control Nefit boiler - by admin - 26.09.2025, 13:39
RE: Control Nefit boiler - by gjniewenhuijse - 26.09.2025, 13:49
RE: Control Nefit boiler - by admin - 26.09.2025, 14:05
RE: Control Nefit boiler - by maxmp - 26.09.2025, 21:00
RE: Control Nefit boiler - by gjniewenhuijse - 29.09.2025, 08:58

Forum Jump: