Created
April 28, 2018 21:56
-
-
Save yoimbert/68043ba1af2fd0ec42fb22e5d5cf963c to your computer and use it in GitHub Desktop.
luaLights
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Code Lua Interessant :p | |
-- Allumage des lumières lorsque la variable Giorno_Notte passe à "Notte" | |
-- Déclenchement du setTimeout | |
-- Si >= 23:30 alors on éteint. | |
--[[ | |
%% properties | |
%% globals | |
Giorno_Notte | |
--]] | |
-- check script instance count in memory | |
if (fibaro:countScenes() > 1) then | |
fibaro:debug("Script already running."); | |
fibaro:abort(); | |
end | |
fibaro:debug(os.date() .. " - Script start"); | |
function tempFunc() | |
local currentDate = os.date("*t"); | |
if (string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) >= "23:30") then | |
fibaro:call(316, "turnOff"); | |
fibaro:call(47, "turnOff"); | |
fibaro:call(49, "turnOff"); | |
fibaro:debug("OFF"); | |
-- MULTIPE MORE THINGS AT DIFFERENT TIMES.... | |
end | |
setTimeout(tempFunc, 60*1000); | |
end | |
if (fibaro:getGlobalValue("Giorno_Notte") == "Notte") then | |
fibaro:call(316, "turnOn"); | |
fibaro:call(47, "turnOn"); | |
fibaro:call(49, "turnOn"); | |
fibaro:debug("ON"); | |
-- MULTIPE MORE THINGS AT DIFFERENT TIMES.... | |
tempFunc(); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment