Guest User

Untitled

a guest
Nov 24th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.53 KB | None | 0 0
  1. -- Alexandre DUBOIS - 2014
  2. -- Ce script permet de maintenir la température de la salle de bain entre 17°C et 19°C quand l'interrupteur
  3. -- virtuel 'Thermostat salon' est activé.
  4.  
  5. --------------------------------
  6. ------ Variables à éditer ------
  7. --------------------------------
  8. -- local consigne = 19  --Température de consigne
  9. local consigne = tonumber(otherdevices_svalues['Consigne SdB'])
  10. local hysteresis1 = 0.5 --Valeur seuil superieure
  11. local hysteresis2 = 1 --Valeur seuil inferieure
  12. local sonde = 'Salle de Bain' --Nom de la sonde de température
  13. local thermostat = 'Thermostat Salle de Bain' --Nom de l'interrupteur virtuel du thermostat
  14. local radiateur = 'Radiateur Salle de Bain' --Nom du radiateur à allumer/éteindre
  15. local radiateur2 = 'Soufflant Salle de Bain'
  16. local absent = 'Mode ABSENT'
  17. local consigneabsent = tonumber(otherdevices_svalues['Consigne ABSENT'])
  18. --------------------------------
  19. -- Fin des variables à éditer --
  20. --------------------------------
  21.  
  22. commandArray = {}
  23.  
  24. local temperature = otherdevices[string.format('%s_Temperature', sonde)] --Temperature relevée dans la salle de bain
  25.         if (otherdevices[absent]=='Off') then
  26.             --On n'agit que si le "Thermostat" est actif
  27.                 if (otherdevices[thermostat]=='On') then
  28.                         print('-- Gestion du thermostat pour la Salle de Bain --')
  29.  
  30.                         if (temperature < (consigne - hysteresis2) ) then
  31.                                 print('Allumage du chauffage dans la Salle de Bain')
  32.                                 commandArray[radiateur]='On'
  33.                                 commandArray[radiateur2]='On'
  34.                         elseif (temperature > (consigne + hysteresis1)) then
  35.                                 print('Extinction du chauffage dans la Salle de Bain')
  36.                                 commandArray[radiateur]='Off'
  37.                                 commandArray[radiateur2]='Off'
  38.                         end
  39.                 elseif (otherdevices[thermostat]=='Off') then
  40.                         print('Fin de la régulation')
  41.                         commandArray[radiateur]='Off'
  42.                         commandArray[radiateur2]='Off'
  43.                 end
  44.         else
  45.                 --On n'agit que si le "Thermostat" est actif
  46.                 if (otherdevices[thermostat]=='On') then
  47.                         print('-- Gestion du thermostat pour la Salle de Bain --')
  48.                         if (temperature < (consigneabsent - hysteresis2) ) then
  49.                                 print('Allumage du chauffage dans la Salle de Bain')
  50.                                 commandArray[radiateur]='On'
  51.                                 commandArray[radiateur2]='On'
  52.  
  53.                         elseif (temperature > (consigneabsent + hysteresis1)) then
  54.                                 print('Extinction du chauffage dans la Salle de Bain')
  55.                                 commandArray[radiateur]='Off'
  56.                                 commandArray[radiateur2]='Off'
  57.                         end
  58.                 elseif (otherdevices[thermostat]=='Off') then
  59.                         print('Fin de la régulation')
  60.                          commandArray[radiateur]='Off'
  61.                         commandArray[radiateur2]='Off'
  62.                 end
  63.         end
  64.         if (devicechanged[thermostat]=='Off') and (otherdevices[radiateur]=='On') and (otherdevices[radiateur2]=='On') then
  65.                 commandArray[radiateur]='Off'
  66.                 commandArray[radiateur2]='Off'
  67.         end
  68. end
  69.  
  70. return commandArray
Advertisement
Add Comment
Please, Sign In to add comment