Rollladen-Steuerung (Sonnenaufgang/-untergang)

Hi,

einfach die fibaro:sleep(random*100000); kommentieren. :slight_smile:

Gruß

Guten Morgen Daniel!

Du meintest bestimmt: löschen, richtig? :smiley:

Gruß zurück

Ne, ich meinte schon kommentieren. Einfach – davor und gut. Kannst aber auch löschen, geht auch…

grins und wieder was gelernt! :slight_smile: “–” <-- sehr gut.

Vielen Dank.

Guten Morgen zusammen! :slight_smile:

@Daniel:

Ich habe die Szene jetzt mal getestet. Und, obwohl die Türkontakte "geschlossen waren, sind die beiden Rolläden nicht heruntergefahren. Es sind 569, 573, 575 nicht herunter gefahren. Ich poste die Szene, so wie Du sie mir schicktest hier nochmals.

--[[
%% 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 = fibaro:getValue(1,'sunriseHour');
   local sunsetHour = 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(569, 'open');
                fibaro:call(571, 'open');
                fibaro:call(579, 'open');
                fibaro:call(573, 'open');
                fibaro:call(575, 'open');
                fibaro:call(581, 'open');
    			fibaro:call(590, '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(590, 'close');
                fibaro:call(571, 'close');
                fibaro:call(579, 'close');
    while 		(tonumber(fibaro:getValue(675, 'value')) > 0) do
  				fibaro:sleep(10*1000)
  end
                fibaro:call(573, 'close');
                fibaro:call(575, 'close');
                fibaro:call(581, 'close');
    while 
    			(tonumber(fibaro:getValue(672, 'value')) > 0) do
 				 fibaro:sleep(10*1000)
  end
    			fibaro:call(569, '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

Vielleicht habe ich da einen Denkfehler. Oder kann ich eine zusätzliche Blockszene erstellen, die diese überlagert und dort die Abhängigkeit der Türkontakte mit angeben?

Viele Grüße

Christian

Hi,

und 581 ging runter? Dann hätte das nichts mit dem Skript zu tun.

Gruß

Moin Daniel und ein frohes neues Jahr! :slight_smile:

Ich checke das mal sobald es wieder wärmer wird. Über Silvester hatten wir die Bude echt voll! :smiley:

Viele Grüße

Christian

Hallo Leute,

ich wollte keinen neuen Trade starten, kann mir einer sagen, ob meine LUA-Szene so funktionieren würde.
Ich habe erstmal nur eine Rollade genommen; soll bei LUX wert 0 auf 75% und wenn Nacht auf 100% runterfahren. Morgens auf 50% aufgehen und Tag komplet auf.
–[[
%% properties
180 value
%% events
%% globals
TimeOfDay
–]]

local startSource = fibaro:getSourceTrigger();
if (
( fibaro:getGlobalValue(“TimeOfDay”) == “Evening” )
and
( tonumber(fibaro:getValue(180, “value”)) == 1 )
or
startSource[“type”] == “other”
)
then
fibaro:call(15, “setValue”, “75”);
end
if (fibaro:getGlobal(“TimeOfDay”)== “Night”) then fibaro:call(15, “close”)
end
if (fibaro:getGlobal(“TimeOfDay”)==“Morning”) then fibaro:call(15, “setValue2”, “50”)
end
if (fibaro:getGlobal(“TimeOfDay”)==“Day”) then fibaro:call(15, “open”)
end

Guten Morgen liebe Gemeinde!

Jetzt, da wir wieder Plusgrade haben, arbeitet die Szene wieder.

@Daniel: Bei der Szene, die Du mir geschrieben hat, in die Du die Zeitschleife bei “geöffnetem Türkontakt” eingebaut hast (siehe weiter oben), hat noch ein paar Herausforderungen.

Die Jalousien: 579, 571 und 590 fuhren herunter. Also alles die, die über der Schleife stehen. Wenn ich es richtig verstehe, wird alles, was “unter” der Schleife steht, theoretisch verzögert (in meinem Fall fuhren sie ja nicht runter). Ich habe jetzt mal die Reihenfolge der “Autoren” geändert, so dass zumindest die maximale Anzahl an Rolladen schließt. Siehe hier:

--[[
%% 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 = fibaro:getValue(1,'sunriseHour');
   local sunsetHour = 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(569, 'open');
                fibaro:call(571, 'open');
                fibaro:call(579, 'open');
                fibaro:call(573, 'open');
                fibaro:call(575, 'open');
                fibaro:call(581, 'open');
    			fibaro:call(590, '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(590, 'close');
                fibaro:call(571, 'close');
                fibaro:call(579, 'close');
   		fibaro:call(575, 'close');
                fibaro:call(581, 'close');
    
    while 		(tonumber(fibaro:getValue(675, 'value')) > 0) do
  				fibaro:sleep(10*1000)
  end
                fibaro:call(573, 'close');
    
    while 
    			(tonumber(fibaro:getValue(672, 'value')) > 0) do
 				 fibaro:sleep(10*1000)
  end
    		fibaro:call(569, '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

Für mein Verständnis, arbeiten sich die Zeilen Stück für Stück ab. Wenn jetzt z.B. die Tür “573” geöffnet ist, verzögert der Türkontakt “675” das Herunterfahren. Aber wird damit nicht auch automatisch das Abarbeiten für die “569” verzögert, da sich die Szene in einer Warteschleife befindet? Und erst wen der Timer für die 675 abgelaufen ist, macht die Szene mit dem Schließen weiter?

Liege ich komplett falsch? Oder ist ein wenig Logik bei mir hängen geblieben? :smiley:

Viele Grüße

Christian

Hi,

da ist kein Timer integriert, sondern er macht nicht weiter solange der Türkontakt 675 nicht geschlossen ist. Mit den anderen Punkten hast du Recht. :slight_smile:

Gruß

Hi Daniel!

Ok. Danke. Um das zu umgehen, müßte ich für die zwei betreffenden Türen quasi die Szene duplizieren mit immer nur einem Rolladen drin, oder?

Das sollte ja hinhauen.

Teste ich und melde mich dann wieder.

Danke für Deine Hilfe! :slight_smile:

Gruß

Christian

Klar, das geht :slight_smile:

Reicht denn da die eine globale Variable? Oder soll ich da jeweils eine 1,…2…3… hinter hängen?

Mach am Besten noch neue Variablen.

Hallo Daniel!

So. Ich habe es mal getestet. Hoch fährt der Rolladen. Nur runter leider nicht. Tür ist geschlossen. Eigene Variable ist angelegt und mit “0” abgespeichert! Ins sind auch alle richtig:

Kannst Du auf Anhieb einen Fehler entdecken?

--[[
%% 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 = fibaro:getValue(1,'sunriseHour');
   local sunsetHour = fibaro:getValue(1,'sunsetHour');
    local currentDate = os.date('*t');
   local temp = tonumber(fibaro:getValue(3, 'Temperature'));
   local rollershutter_runs = tonumber(fibaro:getGlobalValue('rollershutterruns2'));
   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('rollershutterruns2', '1');
       			fibaro:debug('Sunrise... Opening rollershutters');
      			--fibaro:debug('Waiting ' .. min .. ' min');
          		--fibaro:sleep(random*100000);
                fibaro:call(569, 'open');
               
       fibaro:debug('Rollershutters opened');
       fibaro:setGlobal('rollershutterruns2', '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('rollershutterruns2', '1'); 
       fibaro:debug('Sunset... Closing rollershutters');
      -- fibaro:debug('Waiting ' .. min .. ' min');
          	--  fibaro:sleep(random*100000);
                
    while 
    			(tonumber(fibaro:getValue(672, 'value')) > 0) do
 				 fibaro:sleep(10*1000)
  end
    			fibaro:call(569, 'close');
       fibaro:debug('Rollershutters closed');
       fibaro:setGlobal('rollershutterruns2', '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('rollershutterruns2', '1');
       fibaro:debug('Sunrise... Temperatur < 0... Rollershutters stay closed.');
       fibaro:setGlobal('rollershutterruns2', '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('rollershutterruns2', '1');
       fibaro:debug('Sunset... Temperatur < 0... Rollershutters stay opened.');
       fibaro:setGlobal('rollershutterruns2', '0');
end
   setTimeout(rollershutter, 60*1000);
end
 
if (sourceTrigger['type'] == 'autostart') then
 rollershutter();
end

Im Debug steht auch nur:

[DEBUG] 18:21:23: Rollershutter-Controller started for the first time (Ver.2.0)

Habe ich versehentlich ein Komma gelöscht? :flushed:

Viele Grüße

Christian

Korrektur. Die Beiden (mit Kontakten versehenen) fahren auch nicht hoch…

Hi,

das liegt daran, dass die eigentliche Funktion nie startet. (Sofern sich der Debug nicht geändert hat)

Schau mal bitte nach, ob die Var wirklich auf 0 steht.

Gruß

Hallo Daniel!

Ich habe jetzt mal den Part mit dem Türkontakt “kommentiert” um zu gucken ob die Szene funktioniert. Das tut sie. Somit macht vielleicht doch die Schleife Probleme…?!

Hier mal die Szene: (die Variablen waren alle richtig…)

--[[
%% 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 = fibaro:getValue(1,'sunriseHour');
   local sunsetHour = fibaro:getValue(1,'sunsetHour');
    local currentDate = os.date('*t');
   local temp = tonumber(fibaro:getValue(3, 'Temperature'));
   local rollershutter_runs = tonumber(fibaro:getGlobalValue('rollershutterruns2'));
   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('rollershutterruns2', '1');
       			fibaro:debug('Sunrise... Opening rollershutters');
      			fibaro:debug('Waiting ' .. min .. ' min');
          		fibaro:sleep(random*100000);
                fibaro:call(569, 'open');
               
       fibaro:debug('Rollershutters opened');
       fibaro:setGlobal('rollershutterruns2', '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('rollershutterruns2', '1'); 
       fibaro:debug('Sunset... Closing rollershutters');
       fibaro:debug('Waiting ' .. min .. ' min');
          	  fibaro:sleep(random*100000);
                
    --while 
    			--( tonumber(fibaro:getValue(672, 'value')) > 0 ) do
 				-- fibaro:sleep(10*1000)
  --end
    			fibaro:call(569, 'close');
       fibaro:debug('Rollershutters closed');
       fibaro:setGlobal('rollershutterruns2', '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('rollershutterruns2', '1');
       fibaro:debug('Sunrise... Temperatur < 0... Rollershutters stay closed.');
       fibaro:setGlobal('rollershutterruns2', '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('rollershutterruns2', '1');
       fibaro:debug('Sunset... Temperatur < 0... Rollershutters stay opened.');
       fibaro:setGlobal('rollershutterruns2', '0');
end
   setTimeout(rollershutter, 60*1000);
end
 
if (sourceTrigger['type'] == 'autostart') then
 rollershutter();
end

Kann ich die Schleife vielleicht noch irgendwie anders einbauen ?

Liebe Grüße

Christian

Hallo Daniel,
hallo liebes Forum,

vorab wieder einmal vielen Dank für die Bereitstellung des Skripts. Ich habe das Skript von Seite 4 des Forums genommen in welchem geprüft wird, ob ein Fester offen ist, wenn nicht wird der Rollladen nicht geschlossen. Nun will ich ungern warten auf den Sonnenaufgang und Untergang bis ich das Skript testen kann, daher habe ich gedacht folgende Punkte anzupassen:

–local sunriseHour = fibaro:getValue(1,‘sunriseHour’); --wird für die Testphase auskommentiert
–local sunsetHour = fibaro:getValue(1,‘sunsetHour’); --wird für die Testphase auskommentiert
local sunriseHour = {19, 50}; --soll anstelle von “local sunriseHour = fibaro:getValue(1,‘sunriseHour’)” hinterlegt werden (fester Zeitwert)
local sunsetHour = {21, 00}; – wie oben

–fibaro:sleep(random*100000); – wurde auskommentiert, damit ich nicht 1-60min warten muss

Rest des Skripts bleibt wie gehabt. Leider wird zu den oben hinterlegten Zeiten (sunriseHour, sunsetHour) nicht hoch bzw. heruntergefahren. Muss ich noch etwas anderes anpassen?
Die Var ist auf 0 gestellt und die Rollläden sind oben.

Vielen Dank
LG Daniel

Hi,

versuch es mal so:

local sunriseHour = ‘08:00’
local sunsetHour = ‘18:00’

Funktioniert bei mir ohne Probleme.

Gruß