sinon est ce que je peux mettre par ex:
Code : Tout sélectionner
-- Récupération de l'heure
timenow = os.date("*t")
local heure = os.date("%H:%M")
if (heure = ['zenith'] - 2) then
Code : Tout sélectionner
-- Récupération de l'heure
timenow = os.date("*t")
local heure = os.date("%H:%M")
if (heure = ['zenith'] - 2) then
Code : Tout sélectionner
sunrise = timeofday['SunriseInMinutes']
sunset = timeofday['SunsetInMinutes']
zenith = (sunrise + sunset) /2 -120
print ("Soleil au zenith - 2 heures : " .. string.sub(os.date("!%X",60*zenith), 1, 5)). Je suis un novice et je ne comprends pas tout...string.sub(os.date("!%X",60*zenith), 1, 5)
Afin de tenter de répondre à ta question :grdsek a écrit : 26 mars 2019, 18:54 est ce que tu pourrais m'expliquer ta dernière ligne: string.sub(os.date("!%X",60*zenith), 1, 5). Je suis un novice et je ne comprends pas tout...
merci d'avance
Code : Tout sélectionner
zenith = os.date("!X",60*zenith) --> renvoie une chaine sous la forme "HH:MM:SS"Code : Tout sélectionner
string.sub (zenith,1,5) --> coupe la chaine du premier au cinquième caractère soit "HH:MM"Code : Tout sélectionner
zenith = (sunrise + sunset) /2 -120
minutesnow = time.min + time.hour * 60
if minutesnow == zenith then
commandArray[#commandArray+1] = {['volet_salon_3'] = 'On'}
commandArray[#commandArray+1] = {['volet_salon_2'] = 'On'}
commandArray[#commandArray+1] = {['volet_salle_à_manger'] = 'On'}
commandArray[#commandArray+1] = {['volet_salon_3'] = 'Stop'}
commandArray[#commandArray+1] = {['volet_salon_2'] = 'Stop'}
commandArray[#commandArray+1] = {['volet_salle_à_manger'] = 'Stop'}
commandArray[#commandArray+1] = {['volet_salon_3'] = 'Stop'}
commandArray[#commandArray+1] = {['volet_salon_2'] = 'Stop'}
commandArray[#commandArray+1] = {['volet_salle_à_manger'] = 'Stop'}
Code : Tout sélectionner
if minutesnow == zenith then
commandArray[#commandArray+1] = {['volet_salon_3'] = 'Off'}
commandArray[#commandArray+1] = {['volet_salon_2'] = 'Off'}
commandArray[#commandArray+1] = {['volet_salle_à_manger'] = 'Off'}
commandArray[#commandArray+1] = {['volet_salon_3'] = 'Stop AFTER 30'}
commandArray[#commandArray+1] = {['volet_salon_2'] = 'Stop AFTER 30'}
commandArray[#commandArray+1] = {['volet_salle_à_manger'] = 'Stop AFTER 30'}
commandArray[#commandArray+1] = {['volet_salon_3'] = 'Stop AFTER 32'}
commandArray[#commandArray+1] = {['volet_salon_2'] = 'Stop AFTER 32'}
commandArray[#commandArray+1] = {['volet_salle_à_manger'] = 'Stop AFTER 32'}
end