Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Alexandre DUBOIS - 2014
- -- Ce script permet de maintenir la température de la salle de bain entre 17°C et 19°C quand l'interrupteur
- -- virtuel 'Thermostat salon' est activé.
- --------------------------------
- ------ Variables à éditer ------
- --------------------------------
- -- local consigne = 19 --Température de consigne
- local consigne = tonumber(otherdevices_svalues['Consigne SdB'])
- local hysteresis1 = 0.5 --Valeur seuil superieure
- local hysteresis2 = 1 --Valeur seuil inferieure
- local sonde = 'Salle de Bain' --Nom de la sonde de température
- local thermostat = 'Thermostat Salle de Bain' --Nom de l'interrupteur virtuel du thermostat
- local radiateur = 'Radiateur Salle de Bain' --Nom du radiateur à allumer/éteindre
- local radiateur2 = 'Soufflant Salle de Bain'
- local absent = 'Mode ABSENT'
- local consigneabsent = tonumber(otherdevices_svalues['Consigne ABSENT'])
- --------------------------------
- -- Fin des variables à éditer --
- --------------------------------
- commandArray = {}
- local temperature = otherdevices[string.format('%s_Temperature', sonde)] --Temperature relevée dans la salle de bain
- if (otherdevices[absent]=='Off') then
- --On n'agit que si le "Thermostat" est actif
- if (otherdevices[thermostat]=='On') then
- print('-- Gestion du thermostat pour la Salle de Bain --')
- if (temperature < (consigne - hysteresis2) ) then
- print('Allumage du chauffage dans la Salle de Bain')
- commandArray[radiateur]='On'
- commandArray[radiateur2]='On'
- elseif (temperature > (consigne + hysteresis1)) then
- print('Extinction du chauffage dans la Salle de Bain')
- commandArray[radiateur]='Off'
- commandArray[radiateur2]='Off'
- end
- elseif (otherdevices[thermostat]=='Off') then
- print('Fin de la régulation')
- commandArray[radiateur]='Off'
- commandArray[radiateur2]='Off'
- end
- else
- --On n'agit que si le "Thermostat" est actif
- if (otherdevices[thermostat]=='On') then
- print('-- Gestion du thermostat pour la Salle de Bain --')
- if (temperature < (consigneabsent - hysteresis2) ) then
- print('Allumage du chauffage dans la Salle de Bain')
- commandArray[radiateur]='On'
- commandArray[radiateur2]='On'
- elseif (temperature > (consigneabsent + hysteresis1)) then
- print('Extinction du chauffage dans la Salle de Bain')
- commandArray[radiateur]='Off'
- commandArray[radiateur2]='Off'
- end
- elseif (otherdevices[thermostat]=='Off') then
- print('Fin de la régulation')
- commandArray[radiateur]='Off'
- commandArray[radiateur2]='Off'
- end
- end
- if (devicechanged[thermostat]=='Off') and (otherdevices[radiateur]=='On') and (otherdevices[radiateur2]=='On') then
- commandArray[radiateur]='Off'
- commandArray[radiateur2]='Off'
- end
- end
- return commandArray
Advertisement
Add Comment
Please, Sign In to add comment