Page 1 of 1

SOLVED: Problem with LUA

Posted: Monday 30 November 2015 9:02
by RobertH
Hello,

I have 2 lua scripts called: script_device_dimmerstue.lua and script_device_dimmersoverom.lua

The first one was added first and is working, nothing happens on the second one but I can see the buttons beeing reffered to is triggered in the log.

First script:

Code: Select all

commandArray = {}
if (devicechanged['Stue dimmer S2 1 click'] == 'On') then
   commandArray['Group:LivingRoom']='On'
   elseif 
   (devicechanged['Stue dimmer S2 2 click'] == 'On') then
   commandArray['Group:LivingRoom']='Off'
   elseif
   (devicechanged['Stue dimmer S2 3 click'] == 'On') then
   commandArray['Group:Alt lys']='Off'
end
return commandArray
Second script:

Code: Select all

commandArray = {}
if (devicechanged['Soverom dimmer S2 1 click'] == 'On') then
   commandArray['Group:Soverom']='On'
   elseif 
   (devicechanged['Soverom dimmer S2 2 click'] == 'On') then
   commandArray['Group:LivingRoomAndSoverom']='Off'
   elseif
   (devicechanged['Soverom dimmer S2 3 click'] == 'On') then
   commandArray['Group:Alt lys']='Off'
end
return commandArray
I have double checked that all the references are correct.
Is there some sort of conflict going on here?

Also after I added the last script the first one is much slower to trigger so I guess there is something strange going on here.

Re: Problem with LUA

Posted: Monday 30 November 2015 19:30
by gizmocuz
before going the lua way... first try this with the default event system (blockly)

Re: Problem with LUA

Posted: Monday 30 November 2015 19:59
by rgroothuis
I had a similar problem, and after searching and searching, debugging it turns out that the names are case sensitive and I had one character incorrect. Make sure the device names are 100% correct. Since that moment I always do copy and paste.

Re: Problem with LUA

Posted: Tuesday 01 December 2015 8:28
by RobertH
Got it solved. By stupid mistake I had not set the devices to used, which was something I did when I named them for the other switch. My bad!