15.09.2020, 14:05
I try to past some data from the Fibaro HC3 gateway (also LUA) to a homeLYnk (2.5.1) but received an error 401.
The same credentials and url works in my browser or from HL to HL.
Anyone a idea why the HL doesn't accept data in that way?
The same credentials and url works in my browser or from HL to HL.
Anyone a idea why the HL doesn't accept data in that way?
Code:
function testHttp(self)
local address = "http://XXX:XXX@XX.XX.XX.XX/scada-remote/request.cgi?m=json&r=grp&fn=write&alias='32/1/1'&value=true"
self.http = net.HTTPClient({timeout=3000})
self.http:request(address, {
options={
headers = {
Accept = "application/json"
},
checkCertificate = false,
method = 'GET'
},
success = function(response)
self:debug("response status:", response.status)
self:debug("headers:", response.headers["Content-Type"])
local data = json.decode(response.data)
end,
error = function(error)
self:debug('error: ' .. json.encode(error))
end
})
end
function QuickApp:onInit()
self:debug("onInit")
testHttp(self)
end