OS Execute  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Pandabeer
Posts: 35
Joined: Monday 18 December 2017 11:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 10265
Location: Zwolle
Contact:

OS Execute

Post 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
Little expert running Domoticz on a Raspberry Pi

Code: Select all

Toon Thermostat | Mi-Light | Z-Wave Thermostat valves and CO2 / fire detection units | KiKa | Heat-IT Zwave thermostat |
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: OS Execute

Post 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 &")
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Pandabeer
Posts: 35
Joined: Monday 18 December 2017 11:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 10265
Location: Zwolle
Contact:

Re: OS Execute

Post 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
Little expert running Domoticz on a Raspberry Pi

Code: Select all

Toon Thermostat | Mi-Light | Z-Wave Thermostat valves and CO2 / fire detection units | KiKa | Heat-IT Zwave thermostat |
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: OS Execute

Post 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
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Pandabeer
Posts: 35
Joined: Monday 18 December 2017 11:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 10265
Location: Zwolle
Contact:

Re: OS Execute

Post by Pandabeer »

Thanks - Tried above suggestion - without any result :oops:
Little expert running Domoticz on a Raspberry Pi

Code: Select all

Toon Thermostat | Mi-Light | Z-Wave Thermostat valves and CO2 / fire detection units | KiKa | Heat-IT Zwave thermostat |
fvdp80
Posts: 70
Joined: Tuesday 14 August 2018 8:22
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10303
Contact:

Re: OS Execute

Post 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.
Pandabeer
Posts: 35
Joined: Monday 18 December 2017 11:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 10265
Location: Zwolle
Contact:

Re: OS Execute  [Solved]

Post 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!
Little expert running Domoticz on a Raspberry Pi

Code: Select all

Toon Thermostat | Mi-Light | Z-Wave Thermostat valves and CO2 / fire detection units | KiKa | Heat-IT Zwave thermostat |
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest