Page 1 of 1

Solved: Need help with LUA script for Fibaro Dimmer

Posted: Saturday 26 December 2015 14:25
by RobertH
Hi,

I already have a LUA device script that I am using but I would like to add some additional functionality to it.
This is what I am using now:

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
What I would like to achive is that when "Stue dimmer S2 1 click" is triggered I would like one of three things to happen:
If Group is Off --> Turn On
If Group is Mixed --> Turn On
If Group is On --> Turn Off

And I would also like the 3 click to additionaly turn off the Power device of my harmony hub, its just like a light switch so I just need to know where to put in the device reference. ;)

Hoping someone can help! :)

Merry Christmas!

Re: Need help with LUA script for Fibaro Dimmer

Posted: Tuesday 05 January 2016 19:13
by RobertH
After much fiddeling I finally managed to solve it on my own. Here is the solution in case it helps somebody else:

Code: Select all

commandArray = {}
if (devicechanged['Stue dimmer S2 1 click'] == 'On') then
	if (otherdevices['Dimmer Stue'] == 'Off' or otherdevices['Stue lamp 1'] == 'Off' or otherdevices['Stue lamp 2'] == 'Off') then
	commandArray['Group:LivingRoom']='On'
	else
	commandArray['Group:LivingRoom']='Off'
	end
  elseif 
  (devicechanged['Stue dimmer S2 2 click'] == 'On') then
  commandArray['Group:LightAndTV']='On'
  elseif
  (devicechanged['Stue dimmer S2 3 click'] == 'On') then
  commandArray['Group:LightAndTV']='Off'
end
return commandArray
For the Group LightAndTV I included the switch for my Harmony TV activity and for the off action i put in "http://192.168.1.111:8080/json.htm?type ... itchcmd=On" which is the PowerOff Harmony action. :D

Robert