Hello could you tell me what Im doing wrong? When I rotate cube in right there should be executed specific scripts, the same for left. Scripts is recognising left and right (printing proper value, but scripts are not executed). Could you help ?
return {
on ={devices ={'Cube_kat'}},
execute = function(dz,item)
local kat = item.nValue
print(kat)
if kat > 0 then
print("Zwiekszam glosnosc")
os.execute ('sh /home/pi/domoticz/scripts/radio/volume_plus.sh')
end
if kat < 0 then
print("Zmniejszam glosnosc")
os.execute ('sh /home/pi/domoticz/scripts/radio/volume_minus.sh')
end
end
}
czasas wrote: ↑Monday 07 October 2019 20:50
Hello could you tell me what Im doing wrong? When I rotate cube in right there should be executed specific scripts, the same for left. Scripts is recognising left and right (printing proper value, but scripts are not executed). Could you help ?
Hard to tell but cannot see anything wrong. Maybe something with domoticz user not having enough authorisation to access the sh script?
I use something similar
Hmmm , I have also 'shake' for one script, the first one below and its working . My permission looks like here:
drwxrwxrwx 2 pi pi 4096 Oct 7 23:24 .
drwxr-xr-x 13 pi pi 4096 Oct 7 18:21 ..
-rwxrwxrwx 1 pi pi 74 Oct 7 18:21 radiozet.sh
-rwxrwxrwx 1 root root 21 Oct 7 18:30 stop.sh
-rwxrwxrwx 1 root root 38 Oct 7 23:24 volume_minus.sh
-rwxrwxrwx 1 root root 38 Oct 7 23:21 volume_plus.sh
czasas wrote: ↑Monday 07 October 2019 23:30
Hmmm , I have also 'shake' for one script, the first one below and its working . My permission looks like here:
Do you have to use sh as shell for these scripts ?
You might get a better indication in the log on what happens if you use this.
return
{
on =
{
devices =
{
'Cube_kat'
}
},
execute = function(dz,item)
local kat = item.nValue
dz.log("nValue of " .. item.name .. ': ' .. item.nValue,dz.LOG_FORCE)
local function osExecute(cmd)
local fileHandle = assert(io.popen(cmd, 'r'))
local commandOutput = assert(fileHandle:read('*a'))
local returnTable = {fileHandle:close()}
dz.log("commandOutput: " .. commandOutput,dz.LOG_FORCE)
dz.log("returncode : " .. returnTable[3],dz.LOG_FORCE)
end
if kat > 0 then
dz.log("Zwiekszam glosnosc",dz.LOG_FORCE)
osExecute ('sh /home/pi/domoticz/scripts/radio/volume_plus.sh')
elseif kat < 0 then
dz.log("Zmniejszam glosnosc",dz.LOG_FORCE)
osExecute ('sh /home/pi/domoticz/scripts/radio/volume_minus.sh')
else
dz.log("Nic nie robie",dz.LOG_FORCE)
end
end
}