co minutę scena poniżej
--[[
%% autostart
%% properties
%% globals
--]]
local sourceTrigger = fibaro:getSourceTrigger();
function tempFunc()
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
( (tonumber(os.date("%H%M")) >= tonumber(string.format("%02d%02d", "00", "00")) and tonumber(os.date("%H%M")) <= tonumber(string.format("%02d%02d", "23", "59"))) and (math.floor(os.time()/60)-math.floor(1422831600/60))%1 == 0 )
)
then
fibaro:call(460, "pressButton", "1");
fibaro:call(461, "pressButton", "1");
fibaro:call(462, "pressButton", "1");
fibaro:call(463, "pressButton", "1");
end
setTimeout(tempFunc, 20*1000)
end
if (sourceTrigger["type"] == "autostart") then
tempFunc()
else
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
startSource["type"] == "other"
)
then
fibaro:call(460, "pressButton", "1");
fibaro:call(461, "pressButton", "1");
fibaro:call(462, "pressButton", "1");
fibaro:call(463, "pressButton", "1");
end
end
if (sourceTrigger["type"] == "other") then
fibaro:call(460, "pressButton", "1");
fibaro:call(461, "pressButton", "1");
fibaro:call(462, "pressButton", "1");
fibaro:call(463, "pressButton", "1");
end
uruchamia urządzenie wirtualne
tcpSocket = Net.FTcpSocket("192.168.1.12", 32001)
bytes, errorCode = tcpSocket:write("test")
if errorCode == 0
then
fibaro:setGlobal("WiFi_Mariusz_WP", "1");
fibaro:log("Mariusz w domu");
else
fibaro:setGlobal("WiFi_Mariusz_WP", fibaro:getGlobal("WiFi_Mariusz_WP") - 1);
fibaro:log("Mariusz poza domem");
end
które ustawia zmienną (mam 4 takie urządzenia dla 4 zmiennych)