I use the Fibaro Home Center Lite box and have connected several devices to it.
I would like to create a virtual device to send my data to a web server with HTTP request but I don't know how to build the request.
thanks
For VD buttons your code should be like this:
local http = Net.FHttp("192.168.0.32", 80);
local response = http:GET("/core/api/api.php?param=2335");
In Main Loop section (and in scenes) it will have kinda different syntax:
local http = net.HTTPClient();
http : request('https://api.lifx.com/v1/lights/label:Light1/state.json?selector=label:Light1&power=on&brightness=0.7', {
options = {
method = "PUT",
headers = {
['Authorization'] = 'Bearer cce26ealkadj764'
},
data = ""
},
success = function(response) fibaro:debug (response.data) end,
error = function(err) fibaro:debug ("Error:" .. err) end
});