I'm running Domoticz (v4.9700) on a RPi, and I'm trying to control powered speakers on a separate RPi using an mpc playlist.
It works if I run the following at the command line:
Code: Select all
sshpass -p <password> ssh pi@<second RPi url> mpc play 1Code: Select all
--
-- This script plays a streaming radio URL when the device is changed
-- It passes an mpc command to another RPi using sshpass and ssh
--
return {
on = {
devices = { 'Kitchen radio' }
},
execute = function(dz)
local level = dz.devices("Kitchen radio").rawData[1]
level = level / 10
local base = "sshpass -p <password> ssh pi@<second RPi url> mpc play "
if level >= 1 and level <= 7 then
cmd = base .. level
print (cmd)
os.execute(cmd)
end
end
}