Page 1 of 1

OS Execute

Posted: Thursday 21 May 2020 21:03
by Pandabeer
Hello - I try to figure out the following

I have a Ilyama Touchscreen in the kitchen on which I Dashticz visualisize - but if nobody is home - I switch off the screen with tvservice -o
With DZevent I run (on motion in the kitchen) the script which enables the touchscreen with tvservice -p - screen turns on but stays black.
on ssh command I run DISPLAY=:0 xdotool mousemove 100 100 2 times and this works - now I add these commend in the Dzevent script as a screenon.sh bas script and as wel as stand alone os.execute lines - but both ways doesn't work. When I start the bash script with blocky I get the 256 error, by adding > /dev/null 2>&1 & the error disapears but still doesn't work :oops: Is there someone who can help me? bash script works on ssh command

bash script

Code: Select all

#!/bin/bash
#Touchscreen Off
tvservice -p
sleep 5
DISPLAY=:0 xdotool mousemove 10 100
sleep 3
DISPLAY=:0 xdotool mousemove_relative 10 100
dzevents

Code: Select all

return {
	on = {
		devices = {
			'SimMuis'
		}
	},
	execute = function(domoticz, device)
		os.execute("/home/pi/domoticz/scripts/bash-on.sh")
	end
}
Image

Thank you in advance for your help and support

Peter

Re: OS Execute

Posted: Friday 22 May 2020 10:27
by waaren
Pandabeer wrote: Thursday 21 May 2020 21:03 I add these commend in the Dzevent script as a screenon.sh bas script and as wel as stand alone os.execute lines - but both ways doesn't work.
Can you try to use full qualified names in the bash script (change tvservice to /usr/bin/tvservice )
and change the os.execute line in dzVents to to
os.execute("sudo /home/pi/domoticz/scripts/bash-on.sh &")

Re: OS Execute

Posted: Friday 22 May 2020 12:52
by Pandabeer
Hi Waaren,

Thank you for your reply and suggestions - I tried, but without any result - if I use the command prompt (ssh) the following command give a reaction on the mouse on the attached touchscreen:

Code: Select all

export DISPLAY=:0
/usr/bin/xdotool mousemove 10 100
/usr/bin/xdotool mousemove_relative 10 100
But when I make it to the following DZevents script - nothing on the screen is happening en the Log file gives the following

Code DZevents:

Code: Select all

return {
	on = {
		devices = {
			'SimMuis'
		}
	},
	execute = function(domoticz, device)
		os.execute("export DISPLAY=:0")
		os.execute("/usr/bin/xdotool mousemove 10 100")
		os.execute("/usr/bin/xdotool mousemove_relative 10 100")
	end
}
Log file

Code: Select all

2020-05-22 12:46:13.451 (DomoKodi Dummies) Light/Switch (SimMuis)
2020-05-22 12:46:13.446 Status: User: Admin initiated a switch command (9/SimMuis/On)
2020-05-22 12:46:13.533 Status: dzVents: Info: Handling events for: "SimMuis", value: "On"
2020-05-22 12:46:13.534 Status: dzVents: Info: ------ Start internal script: SimMuis: Device: "SimMuis (DomoKodi Dummies)", Index: 9
2020-05-22 12:46:13.580 Status: dzVents: Info: ------ Finished SimMuis
Is there another work around to simulate a mouse or key movement within Domoticz to wake up my touchscreen?

Thank you for helping me

Br.
Peter

Re: OS Execute

Posted: Friday 22 May 2020 15:20
by waaren
Pandabeer wrote: Friday 22 May 2020 12:52 I tried, but without any result - if I use the command prompt (ssh) the following command give a reaction on the mouse on the attached touchscreen:
Kind of a long shot but what if you try

Code: Select all

return {
	on = {
		devices = {
			'SimMuis'
		}
	},
	execute = function(domoticz, device)
		os.execute("export DISPLAY=:0; /usr/bin/xdotool mousemove 10 100 ;  /xdotool mousemove_relative 10 100" )
	end
}

Re: OS Execute

Posted: Friday 22 May 2020 21:04
by Pandabeer
Thanks - Tried above suggestion - without any result :oops:

Re: OS Execute

Posted: Sunday 24 May 2020 14:44
by fvdp80
Had the some problems and it had to do with user rights.
Can you try in dzVents:

Code: Select all

os.execute("runuser -l pi -c /home/pi/domoticz/scripts/bash-on.sh")
Where pi should be the user on the RPI.

Re: OS Execute  [Solved]

Posted: Tuesday 26 May 2020 19:49
by Pandabeer
fvdp80 wrote: Sunday 24 May 2020 14:44 Had the some problems and it had to do with user rights.
Can you try in dzVents:

Code: Select all

os.execute("runuser -l pi -c /home/pi/domoticz/scripts/bash-on.sh")
Where pi should be the user on the RPI.

You're my hero!