
I have used how template garage_door_demo.lua and I have changed only my "name devices" and "time offset", but the script not work.
I don't see any log in my web interface. If I remove "and difference > 60 and difference < 70" the mail was sent correctly.
I don't understand what is the problem, can you help me, please?

My domoticz installation is 2020.2 on windows system.
This is the script:
Code: Select all
-- script controllo Luci di Casa
t1 = os.time()
s = otherdevices_lastupdate['S1 - Antibagno - 192.168.20.73']
-- returns a date time like 2013-07-11 17:23:12
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)
commandArray = {}
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = (os.difftime (t1, t2))
if (otherdevices['S1 - Antibagno - 192.168.20.73'] == 'On' and difference > 60 and difference < 70) then
commandArray['SendNotification']='Luce Antibagno#Attenzione, Luce accessa da più di 1 minuto!'
print('Luce Antibagno accesa da più di 1 minuto')
end
return commandArray