Aller au contenu

Scene Zapping Tv


Rem's

Messages recommandés

Bonsoir à  tous,

 

Pour faire simple, je m'en sors pas .... !!

 

Cette scene est un chiffon, issue de block convertie en Lua, avec ma sauce rajoutée dessus (ne venez pas manger ma cuisine .... indigeste !!)

Aurait-il une âme charitable pour me démêler cette affaire.

 

Je voudrai qu'aux heures dites cela actionne le VD de la free-télec, pour Zapper (da'illeurs j'ai appelé cette cène zapping TV ...!!!)

De plus, je voudrai qu'à  12h, pour TLMVP et pour le 20h, si la TV n'est pas allumée, alors quelques appuis en plus pour, power (attente 10 sec), Ok (attente 3 sec), la chaine TV.

--[[
%% autostart
%% properties
%% globals
--]]

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

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) == "16:20") )
) and ( fibaro:getGlobalValue("TV") == "On" )
  then
    -- fibaro:call(56, "pressButton", "11")	
      fibaro:debug("Cas° 1, TV déjà  allumée")
  else
    
 	-- fibaro:call(56, "pressButton", "1") -- Freebox power
      fibaro:sleep(10*1000);
    -- fibaro:call(56, "pressButton", "15")
      fibaro:sleep(3*1000)
    -- fibaro:call(56, "pressButton", "11") -- BFM TV
      fibaro:debug("Cas N° 2, TV déjà  éteinte")
      fibaro:debug("TLMVP")
end
    end
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) == "16:22") )
)
then
    -- fibaro:call(101, "pressButton", "22")
      fibaro:sleep(6*1000);
	-- fibaro:call(105, "pressButton", "4")
      fibaro:debug("12/45 M6")
end
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) == "12:58") )
)
then
    -- fibaro:call(101, "pressButton", "5")
      fibaro:sleep(6*1000);
	-- fibaro:call(105, "pressButton", "1")
      
      fibaro:debug("Journal du 13H")
end

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) == "19:57") )
) and ( fibaro:getGlobalValue("TV") == "On" )
  then
    -- fibaro:call(56, "pressButton", "8")	
    fibaro:debug("Cas° 1, TV déjà  allumée")
    fibaro:debug("Journal de 20h")
  else
    
 	-- fibaro:call(56, "pressButton", "1") -- Freebox power
      fibaro:sleep(10*1000);
    -- fibaro:call(56, "pressButton", "15")
      fibaro:sleep(3*1000)
    -- fibaro:call(56, "pressButton", "8") -- BFM TV
      fibaro:debug("Cas N° 2, TV déjà  éteinte")
      fibaro:debug("Journal de 20h")
end

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) == "12:08") )
) and ( fibaro:getGlobalValue("TV") == "On" )
  then
    -- fibaro:call(56, "pressButton", "11")	
      fibaro:debug("Cas° 1, TV déjà  allumée")
  else
    -- fibaro:call(56, "pressButton", "1") -- Freebox power
      fibaro:sleep(10*1000);
    -- fibaro:call(56, "pressButton", "15")
      fibaro:sleep(3*1000)
    -- fibaro:call(56, "pressButton", "11") -- BFM TV
      fibaro:debug("Cas N° 2, TV déjà  éteinte")
      fibaro:debug("TLMVP")
end
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) == "16:20") )
)
then
    -- fibaro:call(101, "pressButton", "22")
      fibaro:sleep(6*1000);
	-- fibaro:call(105, "pressButton", "4")
      fibaro:debug("12/45 M6")
end
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) == "16:22") )
)
then
    -- fibaro:call(101, "pressButton", "5")
      fibaro:sleep(6*1000);
	-- fibaro:call(105, "pressButton", "1")
      
      fibaro:debug("Journal du 13H")
end

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) == "19:57") )
) and ( fibaro:getGlobalValue("TV") == "On" )
  then
    -- fibaro:call(56, "pressButton", "8")	
    fibaro:debug("Cas° 1, TV déjà  allumée")
    fibaro:debug("Journal de 20h")
  else
    
 	-- fibaro:call(56, "pressButton", "1") -- Freebox power
      fibaro:sleep(10*1000);
    -- fibaro:call(56, "pressButton", "15")
      fibaro:sleep(3*1000)
    -- fibaro:call(56, "pressButton", "8") -- BFM TV
      fibaro:debug("Cas N° 2, TV déjà  éteinte")
      fibaro:debug("Journal de 20h")
end
    fibaro:sleep(60*1000);
  end

D'avance merci pour le coup de main ....

Lien vers le commentaire
Partager sur d’autres sites

×
×
  • Créer...