Rem's Posté(e) le 11 septembre 2023 Signaler Posté(e) le 11 septembre 2023 (modifié) Bonjour à tous, Cela fait quelques temps que je n'avais rien posté sur le fofo; depuis que j'ai du tout réinstaller sur une nouvelle box (encore merci à Lazer) ! J'ai un soucis de scène. Ne sachant pas écrire proprement, je convertis la scène bloc, et je m'en sert de trame pour faire mon script. Seulement voilà, ça bug Il y aurai-il une âme charitable pour me filer un coup de main ... ? Cette scène me permet d'allumer tout seul la TV à l'heure TLMVP (FR2), puis à 12:45 le Journal de M6, puis le journal de 13h, puis le journal de 20h et enfin l'émission quotidien à 20:45. Je souhaite rajouter une interrogation afin de savoir si la TV est déjà allumé, sinon dérouler la suite en allumant la box, bouton "Ok", et bouton 1 (freebox). --[[ %% autostart %% properties %% weather %% events %% globals --]] local sourceTrigger = fibaro:getSourceTrigger(); function tempFunc() local currentDate = os.date("*t"); local startSource = fibaro:getSourceTrigger(); fibaro:startScene(8); -- MAJ Freebox player if ( ( ((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) == "17:20") ) ) and ( fibaro:getGlobalValue("TV") == "On" ) then -- fibaro:call(78, "pressButton", "2") fibaro:debug("TLMVP") else fibaro:debug("Cas N° 2, TV éteinte-1") -- fibaro:call(77, "pressButton", "1") -- Freebox power fibaro:sleep(10*1000); -- fibaro:call(77, "pressButton", "15") fibaro:sleep(3*1000) -- fibaro:call(77, "pressButton", "11") -- TLMVP end if ( ( ((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) == "17:22") ) ) then -- fibaro:call(77, "pressButton", "1"); -- fibaro:call(98, "pressButton", "1"); fibaro:debug("12.45 : M6-1") end if ( ( ((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) == "17:24") ) ) then -- fibaro:call(77, "pressButton", "1"); -- fibaro:call(98, "pressButton", "1"); fibaro:debug("Journal 13h : TF1 13h-1") end if ( ( ((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) == "17:26") ) ) then -- fibaro:call(77, "pressButton", "1"); -- fibaro:call(98, "pressButton", "1"); fibaro:debug("Journal 20h : TF1 20h-1") end if ( ( ((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) == "17:28") ) ) then -- fibaro:call(77, "pressButton", "1"); -- fibaro:call(98, "pressButton", "1"); fibaro:debug("Journal 20h : TMC 20h45-1") end setTimeout(tempFunc, 60*1000) end if (sourceTrigger["type"] == "autostart") then tempFunc() else local currentDate = os.date("*t"); local startSource = fibaro:getSourceTrigger(); if ( startSource["type"] == "other" ) and ( fibaro:getGlobalValue("TV") == "On" ) then -- fibaro:call(77, "pressButton", "1"); -- fibaro:call(98, "pressButton", "1"); fibaro:debug("12h : TLMVP-2") -- end else fibaro:debug("Cas N° 2, TV éteinte-2") -- fibaro:call(77, "pressButton", "1") -- Freebox power fibaro:sleep(10*1000); -- fibaro:call(77, "pressButton", "15") fibaro:sleep(3*1000) -- fibaro:call(77, "pressButton", "11") -- TLMVP end if ( ( ((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) == "15:10") ) ) then -- fibaro:call(77, "pressButton", "1"); -- fibaro:call(98, "pressButton", "1"); fibaro:debug("12.45 : M6-2") end if ( ( ((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) == "15:15") ) ) then -- fibaro:call(77, "pressButton", "1"); -- fibaro:call(98, "pressButton", "1"); fibaro:debug("Journal 13h : TF1-2") end if ( ( ((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) == "15:15") ) ) then -- fibaro:call(77, "pressButton", "1"); -- fibaro:call(98, "pressButton", "1"); fibaro:debug("Journal 20h : TF1 20h-2") end if ( ( ((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) == "15:15") ) ) then -- fibaro:call(77, "pressButton", "1"); -- fibaro:call(98, "pressButton", "1"); fibaro:debug("Journal 20h : TMC 20h45-2") end fibaro:sleep(60*1000) Je joint ma scène ci dessous, d'avance merci du coup de main Modifié le 11 septembre 2023 par Rem's
Messages recommandés