Code: Select all
[/--script_device_deltaT.lua
--This script subtracts two sensors (aanvoer_dv and retour_dv) from eachother and puts the calculated value in a new sensor (to be configured with 'deltat_idx')
local aanvoer_dv = 'CV Aanvoer'
local retour_dv = 'CV Retour'
local deltat_idx = 51
commandArray = {}
--if devicechanged[aanvoer_dv] then
aanvoer = otherdevices_svalues[aanvoer_dv]
retour = otherdevices_svalues[retour_dv]
aanvoer_temp = (aanvoer)
retour_temp = (retour)
commandArray['UpdateDevice'] = deltat_idx .. '|0|' .. string.format("%." .. 1 .. "f", aanvoer_temp - retour_temp)
--end
return commandArray
2018-01-08 22:30:20.220 Error: EventSystem: in DeltaT: [string "..."]:16: attempt to perform arithmetic on global 'aanvoer_temp' (a nil value)
I have not change the script.