Dashticz bash / python script not working
Posted: Friday 04 May 2018 6:48
Hi there.
I have a "Broadlink RM3 mini" which controls my mini receiver. In Domoticz I have created buttons for things such as turn on/off, volume up/down, set input to MD, CD, Aux and so on. These button work by triggering a DZVents script. Everything works fine as long as I push the buttons inside domoticz. However if I push the same buttons in dashticz they do now work.
The script I is stored in a folder on the pi in /home/pi/scripts/anlaeg.sh:
The dzvents script looks like this:
All of the buttons are "push on" button with a 1 second delay for turning off again. I also tried putting the script directly inside the on action of the button as "script:///home/pi/scripts/anlaeg.sh on" for example. As you can see in the dzvents script I have tried both using the wrapper function (anlaeg.sh) and the python directly. The wrapper approach works if I push the buttons inside domoticz but not if I push them in dashticz.
Any tips would be appreciated
I have a "Broadlink RM3 mini" which controls my mini receiver. In Domoticz I have created buttons for things such as turn on/off, volume up/down, set input to MD, CD, Aux and so on. These button work by triggering a DZVents script. Everything works fine as long as I push the buttons inside domoticz. However if I push the same buttons in dashticz they do now work.
The script I is stored in a folder on the pi in /home/pi/scripts/anlaeg.sh:
Code: Select all
#!/bin/bash
/usr/bin/python /home/pi/BlackBeanControl/BlackBeanControl.py -c $1 &
Code: Select all
return {
on = {
devices = {
'Anlæg*'
}
},
execute = function(domoticz, device)
domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
if device.state == 'On' then
if (string.find(device.name,'on')) then
os.execute('/usr/bin/python /home/pi/BlackBeanControl/BlackBeanControl.py onoff')
print('Switched Anlæg on or off')
elseif (string.find(device.name,'CD')) then
os.execute('/home/pi/scripts/anlaeg.sh cd')
print('Switched Anlæg to CD')
elseif (string.find(device.name,'LP')) then
os.execute('/home/pi/scripts/anlaeg.sh aux')
print('Switched Anlæg to LP')
elseif (string.find(device.name,'Stream')) then
os.execute('/home/pi/scripts/anlaeg.sh md')
print('Switched Anlæg to Stream/radio')
elseif (string.find(device.name,'op')) then
os.execute('/home/pi/scripts/anlaeg.sh volup2')
print('Anlæg volume op')
elseif (string.find(device.name,'ned')) then
os.execute('/home/pi/scripts/anlaeg.sh voldown2')
print('Anlæg volume down')
end
end
end
}
Any tips would be appreciated