Je met le code fini, ça pourra peut être servir à d'autres !...
Et merci @Gregory
function map_range( a1, a2, b1, b2, s )
return b1 + (s-a1)*(b2-b1)/(a2-a1)
end
HC2 = Net.FHttp("192.168.x.xxx",80)
HC2:setBasicAuthentication("admin", "xxxxxxx")
local new_temp = map_range(0, 100, 15, 25, _sliderValue_ )
response ,status, errorCode = HC2:GET("/api/panels/heating?id=5")
jsonTable = json.decode(response)
jsonTable.properties.vacationTemperature = new_temp;
json = json.encode(jsonTable);
HC2:PUT("/api/panels/heating?id=5", json)
fibaro:log("ready")
Ok, merci, j'ai rajouté et je n'ai plus de message d'erreur mais j'ai plus de push !
--[[
%% properties
133 value
25 value
26 value
27 value
28 value
29 value
30 value
31 value
132 value
103 value
131 value
104 value
133 armed
25 armed
26 armed
27 armed
28 armed
29 armed
30 armed
31 armed
132 armed
103 armed
131 armed
104 armed
%% globals
VAR
--]]
local doorID = {133,25,26,27,28,29,30,132,103,131,104};
local trigger = fibaro:getSourceTrigger();
if (trigger['type']=='property')
and
( tonumber(fibaro:getGlobalValue("VAR")) == tonumber("3") )
then
for i =1, #doorID do
--Porte s'ouvre
if (trigger['deviceID']==doorID[i] and tonumber(fibaro:getValue(doorID[i], "armed")) > 0 ) then
fibaro:call(5, "pressButton", "5");
-- fibaro:call(82, "pressButton", "1");
-- fibaro:call(138, "pressButton", "1");
-- fibaro:call(7, "pressButton", "5");
-- fibaro:call(7, "pressButton", "7");
-- fibaro:sleep(15000);
-- fibaro:call(42, "setValue", "100");
-- fibaro:call(38, "setValue", "100");
-- fibaro:call(43, "setValue", "100");
-- fibaro:sleep(135000);
-- fibaro:call(82, "pressButton", "2");
-- fibaro:sleep(30000);
-- fibaro:call(42, "turnOff");
-- fibaro:call(38, "turnOff");
-- fibaro:call(43, "turnOff");
--Porte se ferme
elseif (trigger['deviceID']==doorID[i] and tonumber(fibaro:getValue(doorID[i], "armed")) > 0 ) then
end
end
end