As far as I can see, nothing is wrong.
Domoticz v3.8833
The dzVents script:
Code: Select all
return {
active = true,
on = {
timer = {
'between 11:46 and 12:00'
},
devices = {
'PIR Sensor'
}
},
execute = function(domoticz, device)
if (device.name == 'PIR Sensor' and device.state == 'On') then
domoticz.devices('Lamp Gang').switchOn().forMin(1)
domoticz.log('Lamp gang ingeschakeld door PIR')
end
end
}
Code: Select all
2018-01-20 11:54:56.035 dzVents: Info: Handling events for: "PIR Sensor", value: "Off"
2018-01-20 11:54:56.035 dzVents: Info: ------ Start internal script: PIR2: Device: "PIR Sensor (Aeon Labs Z-Stick GEN5)", Index: 489
2018-01-20 11:54:56.035 dzVents: Info: ------ Finished PIR2
2018-01-20 11:55:00.521 dzVents: Info: ------ Start internal script: PIR2:, trigger: between 11:46 and 12:00
2018-01-20 11:55:00.521 Error: dzVents: Error: An error occured when calling event handler PIR2
2018-01-20 11:55:00.521 Error: dzVents: Error: ...e/pi/domoticz/scripts/dzVents/generated_scripts/PIR2.lua:18: attempt to index local 'device' (a nil value)
2018-01-20 11:55:00.521 dzVents: Info: ------ Finished PIR2
The error "attempt to index local 'device' (a nil value)" disappeared:
Code: Select all
2018-01-20 12:01:43.930 EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2018-01-20 12:02:15.174 dzVents: Info: Handling events for: "PIR Sensor", value: "Off"
2018-01-20 12:02:15.175 dzVents: Info: ------ Start internal script: PIR2: Device: "PIR Sensor (Aeon Labs Z-Stick GEN5)", Index: 489
2018-01-20 12:02:15.175 dzVents: Info: ------ Finished PIR2
2018-01-20 12:02:27.628 dzVents: Info: Handling events for: "PIR Sensor", value: "On"
2018-01-20 12:02:27.629 dzVents: Info: ------ Start internal script: PIR2: Device: "PIR Sensor (Aeon Labs Z-Stick GEN5)", Index: 489
2018-01-20 12:02:27.630 dzVents: Info: Lamp gang ingeschakeld door PIR
2018-01-20 12:02:27.631 dzVents: Info: ------ Finished PIR2