--[[
%% autostart
%% properties
%% globals
--]]
if (fibaro:countScenes() > 1)
then fibaro:abort()
end
local sourceTrigger = fibaro:getSourceTrigger();
function tempFunc()
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if string.format("%02d:%02d", currentDate.hour, currentDate.min) == "00:00"
then
if --feste Feiertage
string.format("%02d-%02d", currentDate.month, currentDate.day) == "01-01" --Neujahrstag
or string.format("%02d-%02d", currentDate.month, currentDate.day) == "01-06" --Heilige Drei Könige
or string.format("%02d-%02d", currentDate.month, currentDate.day) == "05-01" --Tag der Arbeit
or string.format("%02d-%02d", currentDate.month, currentDate.day) == "10-03" --Tag der Deutschen Einheit
or string.format("%02d-%02d", currentDate.month, currentDate.day) == "10-31" --Reformationstag
or string.format("%02d-%02d", currentDate.month, currentDate.day) == "12-25" --1. Weihnachtstag
or string.format("%02d-%02d", currentDate.month, currentDate.day) == "12-26" --2. Weihnachtstag
--variabel 2015
or string.format("%04d-%02d-%02d", currentDate.year, currentDate.month, currentDate.day) == "2015-04-03" --Karfreitag
or string.format("%04d-%02d-%02d", currentDate.year, currentDate.month, currentDate.day) == "2015-04-06" --Ostermontag
or string.format("%04d-%02d-%02d", currentDate.year, currentDate.month, currentDate.day) == "2015-05-14" --Himmelfahrt
or string.format("%04d-%02d-%02d", currentDate.year, currentDate.month, currentDate.day) == "2015-05-25" --Pfingstmontag
--variabel 2016
or string.format("%04d-%02d-%02d", currentDate.year, currentDate.month, currentDate.day) == "2016-03-25" --Karfreitag
or string.format("%04d-%02d-%02d", currentDate.year, currentDate.month, currentDate.day) == "2016-03-28" --Ostermontag
or string.format("%04d-%02d-%02d", currentDate.year, currentDate.month, currentDate.day) == "2016-05-05" --Himmelfahrt
or string.format("%04d-%02d-%02d", currentDate.year, currentDate.month, currentDate.day) == "2016-05-16" --Pfingstmontag
--variabel 2017
or string.format("%04d-%02d-%02d", currentDate.year, currentDate.month, currentDate.day) == "2017-04-14" --Karfreitag
or string.format("%04d-%02d-%02d", currentDate.year, currentDate.month, currentDate.day) == "2017-04-17" --Ostermontag
or string.format("%04d-%02d-%02d", currentDate.year, currentDate.month, currentDate.day) == "2017-05-25" --Himmelfahrt
or string.format("%04d-%02d-%02d", currentDate.year, currentDate.month, currentDate.day) == "2017-06-05" --Pfingstmontag
then
if fibaro:getGlobalValue("Feiertag") == "nein" --nur Änderung, wenn notwendig
then fibaro:setGlobal("Feiertag", "ja");
end
else
if fibaro:getGlobalValue("Feiertag") == "ja" --nur Änderung, wenn notwendig
then fibaro:setGlobal("Feiertag", "nein");
end
end
end
setTimeout(tempFunc, 60*1000)
end
tempFunc()
Da mir die Berechnung zu undurchsichtig war, habe ich mal eine einfachere Variante entwickelt.
Allerdings muss mann hier die variablen Feiertage für die folgenden Jahre manuell anpassen.