un souci d'optimisation de mon coté ?
Code : Tout sélectionner
--script_device_chauffageSalon.lua
local consigneconfortsalon = 18.5 --Température de consigne
local consigneecosalon = 16.5 --Température de consigne
local sondesalon = 'Temp Salon' --Nom de la sonde de température
local modulesalon = 'Module Salon' --Nom du radiateur à allumer/éteindre
commandArray = {}
tempsalon = otherdevices_temperature[sondesalon]
-- conditions de chauffe --
-- marche confort --
if (otherdevices['Calendrier chauffage Salon']=='On') and (tempsalon < consigneconfortsalon ) and (otherdevices['Module Salon']=='Off') and (otherdevices['Pile Salon']=='Off') and (otherdevices['Eco chauffage Salon']=='Off') then
commandArray[modulesalon]='On'
end
-- arret confort --
if (otherdevices['Calendrier chauffage Salon']=='On') and (tempsalon > consigneconfortsalon ) and (otherdevices['Module Salon']=='On') and (otherdevices['Eco chauffage Salon']=='Off') then
commandArray[modulesalon]='Off'
end
-- marche eco --
if (otherdevices['Calendrier chauffage Salon']=='Off') and (tempsalon < consigneecosalon ) and (otherdevices['Module Salon']=='Off') and (otherdevices['Pile Salon']=='Off') and (otherdevices['Eco chauffage Salon']=='Off') then
commandArray[modulesalon]='On'
end
-- arret eco --
if (otherdevices['Calendrier chauffage Salon']=='Off') and (tempsalon > consigneecosalon) and (otherdevices['Module Salon']=='On') and (otherdevices['Eco chauffage Salon']=='Off') then
commandArray[modulesalon]='Off'
end
-- marche eco forcé --
if (otherdevices['Eco chauffage Salon']=='On') and (tempsalon < consigneecosalon ) and (otherdevices['Module Salon']=='Off') and (otherdevices['Pile Salon']=='Off') then
commandArray[modulesalon]='On'
end
-- arret eco forcé --
if (otherdevices['Eco chauffage Salon']=='On') and (tempsalon > consigneecosalon ) and (otherdevices['Module Salon']=='On') then
commandArray[modulesalon]='Off'
end
return commandArray