[SOLVED] Pproblems with combined triggerrules
Posted: Thursday 08 March 2018 12:40
This dzVents script has to run every minute. But only when a Percentage Device has a value is > 0
This is the trigger part of the code
The log shows I do something wrong with (device.name == 'Bpump' and device.percentage > 0) But I can't figure out what
Who can point me at the right direction?
This is the trigger part of the code
Code: Select all
local Bpump = 64 -- Index of a Percentage Virtual Device
on = {
timer = { 'every minute' },
devices = { 'Bpump' }
},
execute = function(domoticz, triggerItem)
if (triggerItem.isTimer) and
(device.name == 'Bpump' and device.percentage > 0) then
domoticz.log('Script is running.', domoticz.LOG_DEBUG)
else
-- do nothing
end
Who can point me at the right direction?
Code: Select all
2018-03-08 12:10:01.168 dzVents: Info: VSEB 0.0.1: ------ Start internal script: Heat-Counter:, trigger: every minute
2018-03-08 12:10:01.169 dzVents: Error (2.4.1): VSEB 0.0.1: An error occured when calling event handler Heat-Counter
2018-03-08 12:10:01.169 dzVents: Error (2.4.1): VSEB 0.0.1: ...oticz/scripts/dzVents/generated_scripts/Heat-Counter.lua:44: attempt to index global 'device' (a nil value)
2018-03-08 12:10:01.169 dzVents: Info: VSEB 0.0.1: ------ Finished Heat-Counter