I can't seem to update a device status with LUA script.
Situation
- I have a user variable 'var-security'
- A device named 'Alarm' setup as a 'selector' with two levels:
10: AAN
20: UIT
I try to run a LUA script to update the device status to AAN or UIT when the user variable 'var-security' is updated from 1 to 0 or the other way around.
Code: Select all
commandArray = {}
if ( uservariables['var-security'] == '1' ) then
commandArray ['Alarm'] = 'Set Level: 10'
elseif ( uservariables['var-security'] == '0' ) then
commandArray ['Alarm'] = 'Set Level: 20'
end
return commandArray
Using commandArray ['Alarm'] = 'AAN' or 'On' or '1' does not work either.
Any tips or solutions for this?
A completely new code is welcome too.
Thanks,
Roel