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?
I get the following response in the log:
In case it's done; I'll post the full code here.
²https://www.opendtu.solar/firmware/web_api/#list-of-urls
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