Aller au contenu

Recommended Posts

Bonsoir a tous : Version technicolor (c'est super pratique et super clair, merci pour l'explication)

 

je voudrai regrouper mes scènes à  travers un script lua, plus complet. Seulement voila, pour moi c'est du "mandarin" que j'essaye de décrypter.

 

Je joint ma scène complète, si quelqu'un pouvait m'en dire plus ....

local sourceTrigger = fibaro:getSourceTrigger();
if (sourceTrigger["type"] == "autostart") then
while true do

local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
 ( ((currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "06:45") )
)
then
local startSource = fibaro:getSourceTrigger();
if (sourceTrigger["type"] == "autostart") then
while true do -- réveil à  6h45 --
	fibaro:call(71, "turnOn");
    fibaro:call(14, "turnOn");
elseif ( tonumber(fibaro:getValue(49, "valueSensor")) <= 5
then      
	fibaro:call(56, "pressButton", "1");
    fibaro:sleep(7*1000);	
    fibaro:call(56, "pressButton", "14");
	fibaro:sleep(2*1000);
	fibaro:call(56, "pressButton", "9");
    fibaro:sleep(2*1000);
	fibaro:call(56, "pressButton", "5");
    fibaro:call(41, "turnOn");
      
      fibaro:debug("Lancement du réveil");
       
      -- Allumage TV + BFM --
	
    fibaro:sleep(900*1000);
      -- Lancement de l'extinction des lumières
   
    fibaro:call(11, "turnOn");
    fibaro:sleep(900*1000);
    fibaro:call(11, "turnOff");
    fibaro:call(14, "turnOff");
    fibaro:call(41, "turnOff");
      fibaro:debug("Extinction salon");
    fibaro:call(56, "pressButton", "1");
      fibaro:debug("Bascule vers Disney channel");
      -- Virtuel device pour basculer de BFM vers Disney Channel --
    
    fibaro:sleep(4000*1000);
      -- Extinction lampe entrée à  8h, 1h 30 plus tard
	fibaro:call(71, "turnOff);
      fibaro:debug("Extinction entrée");

end

fibaro:sleep(60*1000);
end
  
end


D'avance merci pour votre aide.

Partager ce message


Lien à poster
Partager sur d’autres sites

Merci d’éditer ton message et d'utiliser les balises spéciale pour code : <>

Partager ce message


Lien à poster
Partager sur d’autres sites

avec plaisir, je ne sais pas comment faire. C'est pour cela que j'ai mis ce PS.

Partager ce message


Lien à poster
Partager sur d’autres sites

Phil te l'a dit. Tu clic sur <> et tu inseres ton code dedans puis Ok. Et il sera colorisé sur le forum.

Si t'es sur mac j'ai colorisé au theme Fibaro "sublime text", tu trouveras un sujet dans le forum làdessus.

Partager ce message


Lien à poster
Partager sur d’autres sites


local sourceTrigger = fibaro:getSourceTrigger();

if (sourceTrigger["type"] == "autostart") then

while true do

local currentDate = os.date("*t");

local startSource = fibaro:getSourceTrigger();

if (

( ((currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "06:45") )

)

then

local startSource = fibaro:getSourceTrigger();

if (sourceTrigger["type"] == "autostart") then

while true do -- réveil à6h45 --

fibaro:call(71, "turnOn");

fibaro:call(14, "turnOn");

elseif ( tonumber(fibaro:getValue(49, "valueSensor")) <= 5

then

fibaro:call(56, "pressButton", "1");

fibaro:sleep(7*1000);

fibaro:call(56, "pressButton", "14");

fibaro:sleep(2*1000);

fibaro:call(56, "pressButton", "9");

fibaro:sleep(2*1000);

fibaro:call(56, "pressButton", "5");

fibaro:call(41, "turnOn");

fibaro:debug("Lancement du réveil");

-- Allumage TV + BFM --

fibaro:sleep(900*1000);

-- Lancement de l'extinction des lumières

fibaro:call(11, "turnOn");

fibaro:sleep(900*1000);

fibaro:call(11, "turnOff");

fibaro:call(14, "turnOff");

fibaro:call(41, "turnOff");

fibaro:debug("Extinction salon");

fibaro:call(56, "pressButton", "1");

fibaro:debug("Bascule vers Disney channel");

-- Virtuel device pour basculer de BFM vers Disney Channel --

fibaro:sleep(4000*1000);

-- Extinction lampe entrée à8h, 1h 30 plus tard

fibaro:call(71, "turnOff);

fibaro:debug("Extinction entrée");

end

fibaro:sleep(60*1000);

end

end

Partager ce message


Lien à poster
Partager sur d’autres sites

Regarde du coté du scheduleur tu feras sa en 3 ou 4 lignes.

Et c'est la meilleur solution, car faut pas une coupure ou que ta box plante car tout s'arrete dans ce cas.

Partager ce message


Lien à poster
Partager sur d’autres sites

×