Hallo Hoggle,
hier die Konvertierung in LUA.
Neustart ist durchgeführt, muss aber erst noch den Regen simulieren…
–[[
%% autostart
%% properties
%% events
%% globals
–]]
local sourceTrigger = fibaro:getSourceTrigger();
function tempFunc()
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
( ((currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7) and string.format("%02d", currentDate.hour) … “:” … string.format("%02d", currentDate.min) == “20:00”) and fibaro:getGlobalValue(“Regensensor”) == “trocken” and fibaro:getGlobalValue(“Regenwassertank”) == “voll” and fibaro:getValue(3, “WeatherConditionConverted”) ~= “rain” )
)
then
fibaro:call(77, “turnOn”);
fibaro:call(96, “turnOn”);
fibaro:call(98, “turnOn”);
fibaro:call(100, “turnOn”);
fibaro:setGlobal(“Bewaesserung”, “Aus”);
fibaro:call(5, “sendDefinedPushNotification”, “96”);
setTimeout(function()
fibaro:call(77, “turnOff”);
fibaro:call(96, “turnOff”);
fibaro:call(98, “turnOff”);
fibaro:call(100, “turnOff”);
fibaro:call(5, “sendDefinedPushNotification”, “97”);
end, 1200000)
end
setTimeout(tempFunc, 60*1000)
end
if (sourceTrigger[“type”] == “autostart”) then
tempFunc()
else
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
( (currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7) and fibaro:getGlobalValue(“Regensensor”) == “trocken” and fibaro:getGlobalValue(“Regenwassertank”) == “voll” and fibaro:getValue(3, “WeatherConditionConverted”) ~= “rain” )
or
startSource[“type”] == “other”
)
then
fibaro:call(77, “turnOn”);
fibaro:call(96, “turnOn”);
fibaro:call(98, “turnOn”);
fibaro:call(100, “turnOn”);
fibaro:setGlobal(“Bewaesserung”, “Aus”);
fibaro:call(5, “sendDefinedPushNotification”, “96”);
setTimeout(function()
fibaro:call(77, “turnOff”);
fibaro:call(96, “turnOff”);
fibaro:call(98, “turnOff”);
fibaro:call(100, “turnOff”);
fibaro:call(5, “sendDefinedPushNotification”, “97”);
end, 1200000)
end
end`