Guest User

Lua_Check_Temp_Domoticz

a guest
Jul 28th, 2017
536
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local function round(num, n)
  2.   local mult = 10^(n or 0)
  3.   return math.floor(num * mult + 0.5) / mult
  4. end
  5.  
  6. commandArray = {}
  7. if (devicechanged['Temperature balcon']) then
  8.     if ((tonumber(otherdevices_temperature['Temperature balcon']) > tonumber(otherdevices_temperature['Temperature Salon'])) and uservariables['notifsalon'] == '0') then
  9.         commandArray['SendEmail']='Temperature Balcon#La temperature du Balcon '..round(otherdevices_temperature['Temperature balcon'],2)..'°c est plus elevee que la temperature du Salon '..round(otherdevices_temperature['Temperature Salon'],2)..'°c.#adresse_mail@mail.com'
  10.         commandArray['Variable:notifsalon']='1'
  11.     elseif ((tonumber(otherdevices_temperature['Temperature balcon']) < tonumber(otherdevices_temperature['Temperature Salon'])) and uservariables['notifsalon'] == '1') then
  12.         commandArray['SendEmail']='Temperature Balcon#La temperature du Balcon '..round(otherdevices_temperature['Temperature balcon'],2)..'°c est plus basse que la temperature du Salon '..round(otherdevices_temperature['Temperature Salon'],2)..'°c.#adresse_mail@mail.com'
  13.         commandArray['Variable:notifsalon']='0'
  14.     end
  15. end
  16. return commandArray
RAW Paste Data