I am new to Domoticz.
I have a thin client at home with Windows7 running domoticz.
it is connected with an RF link and Xiaomi gateway, switch, smart switches and door sensors are present.
I have been trying to get a script working that will send me a mail if the front door does not open within 1 minute after someone has pressed the bell
the hard part is to not send a mail if the door opens on time.
[
Code: Select all
return {
on = {
devices = {'Bel', 'Door1'
}
},
execute = function(dz, device)
if (device.state == 'On') then
dz.log('Device ' .. device.name .. ' was changed- so sombody ring it', dz.LOG_INFO)
dz.mail('subject', 'message tekst','[email protected]').AfterMin(2)
end
if (dz.devices('Door1').state == 'Open') then
dz.log('Device ' .. device.name .. ' was changed- so sombody opend the door', dz.LOG_INFO)
dz.mail.cancelQueuedCommands()
end
end
}
2018-04-04 16:14:15.936 User: Admin initiated a switch command (77/Bel/On)
2018-04-04 16:14:15.962 (Dummy) Light/Switch (Bel)
2018-04-04 16:14:16.670 dzVents: Info: Handling events for: "Bel", value: "On"
2018-04-04 16:14:16.671 dzVents: Info: ------ Start internal script: test-deurbel: Device: "Bel (Dummy)", Index: 77
2018-04-04 16:14:16.671 dzVents: Info: Device Bel was changed- so sombody ring it
2018-04-04 16:14:16.671 dzVents: Error (2.4.2): An error occured when calling event handler test-deurbel
2018-04-04 16:14:16.671 dzVents: Error (2.4.2): ...oticz\scripts\dzVents\generated_scripts/test-deurbel.lua:9: attempt to call field 'mail' (a nil value)
2018-04-04 16:14:16.672 dzVents: Info: ------ Finished test-deurbel
if i thak line 9 out it is line 11 on error. Please Help me understand