LUA script and selector switch
Posted: Saturday 12 September 2020 9:00
I use virtual selector switch to turn on/off, channel up/down of radio receiver. My goal is to move appropriate commands from sensor definition to LUA script.
Below current definition of "Radio" sensor:
The LUA script as shown below, does not work. Of course in case of using LUA, actions definitions from sensor definition are removed.
What error I am doing? Any idea to correct/modify something?
Below current definition of "Radio" sensor:
The LUA script as shown below, does not work. Of course in case of using LUA, actions definitions from sensor definition are removed.
Code: Select all
local sensor = 'Radio'
commandArray = {}
if (devicechanged[sensor] == 'Wyłączone') then
os.execute ("/home/pi/Pobrane/radio 0")
elseif (devicechanged[sensor] == 'Stacja +') then
os.execute ("/home/pi/Pobrane/radio 100")
elseif (devicechanged[sensor] == 'Stacja -') then
os.execute ("/home/pi/Pobrane/radio 101")
end
return commandArray