Hey ,
ich nochmal. Hatte das Script jetz folgendermaßen zum Laufen gebracht.
--[[
%% autostart
%% properties
%% globals
--]]
local sourceTrigger = fibaro:getSourceTrigger();
local version = '2.0';
fibaro:debug('Rollershutter-Controller started for the first time (Ver.' .. version .. ')');
function rollershutter()
local version = '2.0';
local sunriseHour = '7:00'; --fibaro:getValue(1,'sunriseHour');
local sunsetHour = '21:00'; --fibaro:getValue(1,'sunsetHour');
local currentDate = os.date('*t');
local temp = tonumber(fibaro:getValue(3, 'Temperature'));
local rollershutter_runs = tonumber(fibaro:getGlobalValue('rollershutter_runs'));
local random = math.random(35);
local min = math.floor((random*100)/60);
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) == sunriseHour)) and rollershutter_runs == 0 and tonumber(temp)>=0)
then
fibaro:debug('Rollershutter-Controller started (Ver.' .. version .. ')');
fibaro:setGlobal('rollershutter_runs', '1');
fibaro:debug('Sunrise... Opening rollershutters');
fibaro:debug('Waiting ' .. min .. ' min');
-- fibaro:sleep(random*100000);
fibaro:call(64, 'open');
fibaro:call(102, 'open');
fibaro:call(66, 'open');
fibaro:call(68, 'open');
fibaro:call(188, 'open');
fibaro:call(23, 'open');
fibaro:call(27, 'open');
fibaro:call(25, 'open');
fibaro:debug('Rollershutters opened');
fibaro:setGlobal('rollershutter_runs', '0');
elseif ((((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) == sunsetHour)) and rollershutter_runs == 0 and tonumber(temp)>=0)
then
fibaro:debug('Rollershutter-Controller started (Ver.' .. version .. ')');
fibaro:setGlobal('rollershutter_runs', '1');
fibaro:debug('Sunset... Closing rollershutters');
fibaro:debug('Waiting ' .. min .. ' min');
-- fibaro:sleep(random*100000);
fibaro:call(102, 'close');
fibaro:call(66, 'close');
fibaro:call(188, 'close');
fibaro:call(23, 'close');
fibaro:call(27, 'close');
fibaro:call(25, 'close');
while (tonumber(fibaro:getValue(176, 'value')) > 0) do
fibaro:sleep(10*1000)
end
fibaro:call(64, 'close');
while
(tonumber(fibaro:getValue(18, 'value')) > 0) do
fibaro:sleep(10*1000)
end
fibaro:call(68, 'close');
fibaro:debug('Rollershutters closed');
fibaro:setGlobal('rollershutter_runs', '0');
elseif ((((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) == sunriseHour)) and rollershutter_runs == 0 and tonumber(temp)<=0)
then
fibaro:debug('Rollershutter-Controller started (Ver.' .. version .. ')');
fibaro:setGlobal('rollershutter_runs', '1');
fibaro:debug('Sunrise... Temperatur < 0... Rollershutters stay closed.');
fibaro:setGlobal('rollershutter_runs', '0');
elseif ((((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) == sunsetHour)) and rollershutter_runs == 0 and tonumber(temp)<=0)
then
fibaro:debug('Rollershutter-Controller started (Ver.' .. version .. ')');
fibaro:setGlobal('rollershutter_runs', '1');
fibaro:debug('Sunset... Temperatur < 0... Rollershutters stay opened.');
fibaro:setGlobal('rollershutter_runs', '0');
end
setTimeout(rollershutter, 60*1000);
end
if (sourceTrigger['type'] == 'autostart') then
rollershutter();
end
Jedoch ergibt sich ein Problem bei geöffneter Tür. Ich habe 2 Kontakte jeweils vorne und hinten am haus.
Ist eine tür auf bleibt das Rollo oben allerdings auch das an der Haushinterseite welche mit dem 2.Kontakt belegt ist.
Es soll ja nur das oben bleiben bei dem auch die Tür auf ist.
Gibt es nen Tipp
Danke schonmal.
Grüße