14.12.2021, 17:44
hello, I was going crazy trying to command on a single group at a time, without succeeding. On and OFF acted on all groups. When I noticed in the function in the library what I think is an oversight:
I guess Light_num on url in 4 row is wrong and to be subsustite by Group_num.... am I right?
By the way, can I address a group by its name?
Code:
function sendToGroup(Group_num,body_request)
local response = {}
socket.http.request({
url = "http://"..ip_add.."/api/"..user.."/groups/"..tostring(Light_num).."/action",
method = 'PUT',
sink = ltn12.sink.table(response),
headers = {
['content-length'] = #body_request,
['content-type'] = 'application/json',
},
source = ltn12.source.string(body_request),
})
return response
end
I guess Light_num on url in 4 row is wrong and to be subsustite by Group_num.... am I right?
By the way, can I address a group by its name?