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.

openDTU - JSON - http post - "no values found"
#1
Hi all,

I'm trying to integrate / control openDTU² into my W4k. I can already read the data from my openDTU. Now I'm trying to write data to my openDTU, which fails. Any idea?

Code:
json = require('json')
http = require('socket.http')

body = json.encode({
    limit_value = '10',
    limit_type = '1',
    serial = '000000000000'
})

resp, code, hdrs, stat = http.request({
  url = 'http://192.168.1.000/api/limit/config',
  method = 'POST',
  headers = {
    ['Authorization'] = 'Basic '..(mime.b64('admin:password')),
    ['Content-Type'] = 'application/json',
    ['Content-Length'] = #body,
  },
  body
})

log(resp, code, hdrs, stat)

I get the following response in the log:

Code:
* arg: 1
  * nil
* arg: 2
  * string: closed
* arg: 3
  * nil
* arg: 4
  * nil



In case it's done; I'll post the full code here. 

²https://www.opendtu.solar/firmware/web_api/#list-of-urls
Reply


Messages In This Thread
openDTU - JSON - http post - "no values found" - by cgn - 08.06.2024, 10:12

Forum Jump: