W grupie urządzeń są dwa switche które załączaj bądż wyłączają urządzenie.
Mam uruchomione sprawdzanie obecności w domu na podstawie zalogowania iphone do sieci wifi.
--[[
%% autostart
%% properties
%% globals
--]]
local sourceTrigger = fibaro:getSourceTrigger();
if (sourceTrigger["type"] == "autostart") then
while true do
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(1413496800/60))%1 == 0 )
)
then
fibaro:call(466, "pressButton", "1");
fibaro:call(466, "pressButton", "2");
fibaro:call(466, "pressButton", "3");
end
fibaro:sleep(10*1000);
end
else
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
startSource["type"] == "other"
)
then
fibaro:call(466, "pressButton", "1");
fibaro:call(466, "pressButton", "2");
fibaro:call(466, "pressButton", "3");
end
end
Na tej podstawie urządzenie wirtualne ustawia zmienną