带有虚拟设备的 Fibaro Home Center 中的 HTTP 请求
HTTP request in Fibaro Home Center with virtual device
我使用 Fibaro Home Center Lite 盒子并连接了多个设备。
我想创建一个虚拟设备,通过 HTTP 请求将我的数据发送到 Web 服务器,但我不知道如何构建请求。
谢谢
对于 VD 按钮,您的代码应如下所示:
local http = Net.FHttp("192.168.0.32", 80);
local response = http:GET("/core/api/api.php?param=2335");
在主循环部分(和场景中)它会有一些不同的语法:
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
});
我使用 Fibaro Home Center Lite 盒子并连接了多个设备。
我想创建一个虚拟设备,通过 HTTP 请求将我的数据发送到 Web 服务器,但我不知道如何构建请求。
谢谢
对于 VD 按钮,您的代码应如下所示:
local http = Net.FHttp("192.168.0.32", 80);
local response = http:GET("/core/api/api.php?param=2335");
在主循环部分(和场景中)它会有一些不同的语法:
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
});