Put this in Domoticz events, Lua script TYPE (VERY IMPORTANT) is "device" (not the default "all").
Code: Select all
commandArray = {}
if (devicechanged['SwitchNAME'] == 'On') then
os.execute ('/root/scripts/zrc90/bedroom/onscript.sh &')
elseif (devicechanged['SwitchNAME'] == 'Off') then
os.execute ('/root/scripts/zrc90/bedroom/offscript.sh &')
end
return commandArray
SwitchNAME is a virtual switch you created, the event system will watch and when it changes to on or off execute the bash / sh script accordingly.
The & symbol should be kept after the script name, if you remove it, it will still work but could slow down the Domoticz event system.
Cheers