-
-
Notifications
You must be signed in to change notification settings - Fork 26
Examples to use LUA script for switch
Smanar edited this page Mar 29, 2019
·
13 revisions
You have two way to make LUA scripts.
- make a file called "script_device_That_You_Want.lua in "/home/pi/domoticz/scripts/lua"
- go to "Setting" / "More options" / "Event" / "LUA"
-- Some LUA exemples
commandArray = {}
-- Switch 1
if (devicechanged['deCONZ - Switch 1']) then
print("Switch 1")
local b = devicechanged['deCONZ - Switch 1']
if b == 'B1' then
if (otherdevices['deCONZ - Coridor']== 'On') then
commandArray['deCONZ - Cordidor'] = 'Off'
else
commandArray['Scene:Light Cordidor'] = 'On'
end
end
end
return commandArray
I m using scene, because you can easily set light value, color or temporisation. To see wich one button to use (B1,B2,B3,...), just enable log "Debug info Only".