j'ai presque que trouver
quand je rajoute a la variable local msg : "https://telegram.org/img/t_logo.png"
je reçois la l'image.
le truc est savoir comment aller chercher dans la HC2 le "jpgPath": "Streaming/channels/1/picture" (la capture de l'image video)
et le placer dans la variable msg
--[[
%% properties
%% globals
--]]
local debug = true;
local token = "xxxxxxxxxxxxxxxxxx"
local chat_id = "xxxxxxxxxxxx"
local url = "https://api.telegram.org/bot"..token.."/sendPhoto?chat_id="..chat_id.."&photo="
local function log(str) if debug then fibaro:debug(str); end; end
local function errorlog(str) fibaro:debug("<font color='red'>"..str.."</font>"); end
--Prevents the scene from running again
local selfhttp = net.HTTPClient({timeout=2000})
---***********************************************----
local msg = "https://telegram.org/img/t_logo.png"
---***********************************************----
log(msg);
url = url .. msg
selfhttp:request(url, {
options={
headers = selfhttp.controlHeaders,
data = requestBody,
method = 'GET',
timeout = 5000
},
success = function(status)
local result = json.decode(status.data);
if result.ok == true then
log("successful");
else
errorlog("failed");
log(status.data);
end
end,
error = function(error)
errorlog("ERROR")
log(error)
end
})