SOLVED: Problem with LUA

Moderator: leecollings

Post Reply
RobertH
Posts: 12
Joined: Sunday 15 November 2015 19:10
Target OS: Windows
Domoticz version:
Location: Norway, Kongsberg
Contact:

SOLVED: Problem with LUA

Post 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.
Last edited by RobertH on Tuesday 01 December 2015 8:29, edited 1 time in total.
Domoticz running on Windows Server 2008 in VMware (ESXi), UZB1 stick, 3x FIBARO FGD212 Dimmer, 1x FIBARO RGBW Controller FGRGBWM-441, 2x FIBARO FGMS001 Motion Sensor and 2x Popp 009006 Plug-in Switch
User avatar
gizmocuz
Posts: 2485
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Problem with LUA

Post by gizmocuz »

before going the lua way... first try this with the default event system (blockly)
Quality outlives Quantity!
rgroothuis
Posts: 347
Joined: Friday 03 April 2015 17:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Problem with LUA

Post 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.
RobertH
Posts: 12
Joined: Sunday 15 November 2015 19:10
Target OS: Windows
Domoticz version:
Location: Norway, Kongsberg
Contact:

Re: Problem with LUA

Post 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!
Domoticz running on Windows Server 2008 in VMware (ESXi), UZB1 stick, 3x FIBARO FGD212 Dimmer, 1x FIBARO RGBW Controller FGRGBWM-441, 2x FIBARO FGMS001 Motion Sensor and 2x Popp 009006 Plug-in Switch
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest