Hi there, my first time here,
I am trying to capture a multipart XML-alertstream from a Hikvision IP camera, but since the stream never closes I never receive a response. The information within the stream, such as VMD, LINEDETECTION, FIELDDETECTION etc. will be used to trigger other scenes or VD's in my HC2 (v4.080).
This is my test scene so far:
fibaro:debug(tostring(fibaro:countScenes())) --to indicate how many instances are running
local http = net.HTTPClient()
http:request ('http://10.1.1.115/Event/notification/alertStream', {
options = {
method = "GET",
headers = {
['Authorization'] = 'Basic XXXXXXXXXXXXXXXXXXXXX'
}
},
success = function (response)
fibaro: debug (‘OK’) end,
error = function (err)
fibaro: debug (‘ERROR’) end
})
fibaro: debug (‘End of Script’)
When running the code, no OK or ERROR will show up, but immediately shows this:
1
End of Script
Running the code again shows:
2 <-- is this an indication that the HTTP connection from instance 1 is still open?
End of Script
Additional info:
The GET method works fine directly from my browser (http://<user>:<pwd>@10.1.1.115/Event/notification/alertStream), but the connection stays open while xml data is continuously being added.
There’s no authorization issue since I am able to get a good response (single XML response) from a simple GET request.
Final goal, of course, is to read response.data in order to do nice things with it. But since nothing shows up… Can someone point me in the right direction? Thanks in advance.