Skip to content

Instantly share code, notes, and snippets.

@yoimbert
Created April 28, 2018 21:56
Show Gist options
  • Save yoimbert/68043ba1af2fd0ec42fb22e5d5cf963c to your computer and use it in GitHub Desktop.
Save yoimbert/68043ba1af2fd0ec42fb22e5d5cf963c to your computer and use it in GitHub Desktop.
luaLights
-- 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