Here my code:
Code: Select all
commandArray = {}
if (devicechanged['Tempsensor']) then
local hysteresis = 0.2
if (otherdevices['Modus'] == 'MANUAL') then
local setpoint = otherdevices['Setpoint MANUAL']
elseif (otherdevices['Modus'] == 'AUTOMATIC') then
local setpoint = otherdevices['Setpoint AUTOMATIC']
end
if (otherdevices['Tempsensor'] < (setpoint - hysteresis)) then
commandArray['Output'] = 'On'
print('ON')
elseif (otherdevices['Tempsensor'] > (setpoint + hysteresis)) then
commandArray['Output'] = 'Off'
print('OFF')
end
end
return commandArray
Code: Select all
2017-10-10 20:13:36.868 Error: EventSystem: in 001: [string "commandArray = {}..."]:13: attempt to perform arithmetic on global 'setpoint' (a nil value)
Code: Select all
2017-10-10 20:14:00.489 Error: EventSystem: in 001: [string "commandArray = {}..."]:3: attempt to index global 'devicechanged' (a nil value)
Thanks!