Voila ce qu'il te faut en script lua time.
Code : Tout sélectionner
-- script_time_testsonde.lua
-- a enregistrer sous /home/pi/domoticz/scripts/lua
-- on récupère le jour
local today = os.date("%A")
--------------------------------
-- Fin des variables à éditer --
--------------------------------
time = os.date("*t")
function timedifference(d)
s = otherdevices_lastupdate[d]
year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)
t1 = os.time()
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = os.difftime (t1, t2)
return difference
end
-- on regarde de quand date la dernière relève de température
local lastSeen = timedifference(sonde)
commandArray = {}
--envoie d'une alerte mail si la sonde reste muette
if (lastSeen >= 18000 and lastSeen < 18060 ) then
commandArray['SendEmail']='Alerte sonde chambre X muette#Alerte sonde chambre X muette#xxxx@free.fr'
end
return commandArray
Le chiffre 18000 correspond à des secondes =>18000 / 60 = 300 min / 60 = 5h, la différence de 60 (18060) correspond à 1min, temps de scrutation des scripts time par le systeme.
Je ne l'ai pas inventé, copier du script de @Vil1driver (voir script chauffage) qui vient d'ici du wiki domoticz
http://www.domoticz.com/wiki/Event_script_examples
Dommage que tu ai posté au mauvais endroit (script...)