Dashticz bash / python script not working

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: robgeerts, htilburgs

Post Reply
wormiedk
Posts: 16
Joined: Wednesday 18 May 2016 5:40
Target OS: Raspberry Pi
Domoticz version:
Contact:

Dashticz bash / python script not working

Post by wormiedk » 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:

Code: Select all

#!/bin/bash
/usr/bin/python /home/pi/BlackBeanControl/BlackBeanControl.py -c $1 &
The dzvents script looks like this:

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
}
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

wormiedk
Posts: 16
Joined: Wednesday 18 May 2016 5:40
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Dashticz bash / python script not working

Post by wormiedk » Friday 04 May 2018 6:49

Domoticz log when pushing the "CD" button inside domoticz:
2018-05-04 06:48:56.426 User: Admin initiated a switch command (517/Anlæg CD/On)
2018-05-04 06:48:56.434 (Dummy) Light/Switch (Anlæg CD)
2018-05-04 06:48:56.598 dzVents: Info: Handling events for: "Anlæg CD", value: "On"
2018-05-04 06:48:56.598 dzVents: Info: ------ Start internal script: Anlaeg: Device: "Anlæg CD (Dummy)", Index: 517
2018-05-04 06:48:56.599 dzVents: Info: Device Anlæg CD was changed
2018-05-04 06:48:56.614 dzVents: Switched Anlæg to CD
2018-05-04 06:48:56.614 dzVents: Info: ------ Finished Anlaeg
2018-05-04 06:48:57.440 (Dummy) Light/Switch (Anlæg CD)
2018-05-04 06:48:57.540 dzVents: Info: Handling events for: "Anlæg CD", value: "Off"
2018-05-04 06:48:57.540 dzVents: Info: ------ Start internal script: Anlaeg: Device: "Anlæg CD (Dummy)", Index: 517
2018-05-04 06:48:57.540 dzVents: Info: Device Anlæg CD was changed
2018-05-04 06:48:57.540 dzVents: Info: ------ Finished Anlaeg

wormiedk
Posts: 16
Joined: Wednesday 18 May 2016 5:40
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Dashticz bash / python script not working

Post by wormiedk » Friday 04 May 2018 19:02

I solved it! Apparently Dashticz always sends an "Off" command for push on or push off buttons... Changing my script to trigger on the off event and changing the buttons to "Push off" worked

Salammbo
Posts: 3
Joined: Saturday 19 May 2018 10:22
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Dashticz bash / python script not working

Post by Salammbo » Saturday 19 May 2018 10:45

Hi all,
Can someone please help me get back to a normal life by sharing a PI3 image with a pre-installed Domiticz including the Broadlink plugin?

I have tried everything in this forum and beyond during 4 days but I did not manage to make it work :( .

Your help will be much appreciated, very very much.

Thank you

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest