commandArray = {} --Fonction trouvée sur http://easydomoticz.com/forum/viewtopic.php?f=10&t=7147 function getDevNameByIdx(devIdx) for i, v in pairs(otherdevices_idx) do if v == devIdx then return i end end return 0 end varDetecteurSDB = getDevNameByIdx(197) varInterrupteur = getDevNameByIdx(217) if (devicechanged[varDetecteurSDB]) then print("SBD : humidité : " .. otherdevices[varDetecteurSDB]) if tonumber(otherdevices[varDetecteurSDB]) > 79 then print("SBD : humidité trop élevée, on allume la VMC") --Si on a pas encore donné l'ordre d'allumage if otherdevices['Variable:varVMCOrdreAllumage'] ~= 'On' then print("SBD : allumage VMC") commandArray[varInterrupteur]='On' commandArray['Variable:varVMCOrdreAllumage']= 'On' end end end return commandArray