Tlačítko je na virtuálním zařízení
HC2 = Net.FHttp("127.0.0.1",11111)
-- get table
response ,status, errorCode = HC2:GET("/api/panels/drenchers")
jsonTable = json.decode(response)
-- change table in Lua for 24 hours delay
jsonTable.rainDelay = "24"
-- send back
json = json.encode(jsonTable);
HC2:PUT("/api/panels/drenchers", json)
fibaro:log("ready")a zde je scéna na zmáčknutí tlačítka:
--[[
%% properties
3 WeatherCondition
%% globals
--]]
local VD_ID = 999 -- enter the ID of your Virtual device
local startSource = fibaro:getSourceTrigger();
condition = fibaro:getValue(3, "WeatherCondition")
fibaro:debug("Weather change: "..condition)
if condition == 'rain' or condition == 'storm'
then fibaro:call(VD_ID, "pressButton", "1");
fibaro:debug('sprinkle delayed 24h')
end