J'ai un problème avec un script qui déclenche tous mes script 5 fois par seconde
Code : Tout sélectionner
------ Declaration des variables
local consigne = 0
local radiateur = 'radiateur_azenor'
Heure_Actuelle=os.date("%X")
local temperature = otherdevices_temperature['chambre_azenor']
local mode = 'mode_azenor' --Selecteur de mode (On, Off force)
local hysteresis = 0.3 --Delai de declanchement
commandArray = {}
if otherdevices[mode]=='nuit' then --On met le radiateur en fonctionnement auto
if (Heure_Actuelle > "19:00:00" and Heure_Actuelle < "22:00:00") then --or otherdevices[interrupteur]=='On' then --on determine les heure du mode confort pour la nuit
consigne=19
else --if (Heure_Actuelle < "19:00:00" and Heure_Actuelle > "22:00:00") then --or otherdevices[interrupteur]=='Off' then --on passe en eco pour le reste de la nuit
consigne=17.5
end
if (temperature <= (consigne-hysteresis)) then
commandArray[radiateur]='On'
elseif (temperature >= (consigne+hysteresis)) then
commandArray[radiateur]='Off'
end
end
if otherdevices[mode]=='confort' then --On passe en mode confort
consigne=19
if (temperature < (consigne-hysteresis)) then
commandArray[radiateur]='On'
elseif (temperature > (consigne+hysteresis)) then
commandArray[radiateur]='Off'
end
end
if otherdevices[mode]=='eco' then --On passe en mode eco
consigne=17.5
if (temperature < (consigne-hysteresis)) then
commandArray[radiateur]='On'
elseif (temperature > (consigne+hysteresis)) then
commandArray[radiateur]='Off'
end
end
if otherdevices[mode]=='Off' then -- Mise a l'arret du radiateur
commandArray[radiateur]='Off'
end
return commandArray