Page 1 of 1

Domoticz runs Python script as root, result is denied for normal user

Posted: Tuesday 18 December 2018 11:27
by McJohn
We have a simple Python script which makes movies with the Raspberry PiCam when there is motion of a motion sensor.
When we run this script (as the normal Pi user) in the terminal or Raspberry GUI, the result (the movie) could be viewed within OMXPlayer.

But when this script is fired trough an event in Domoticz, the result is not viewable because Domoticz makes the permissions of the movie only viewable for the root user. With a chmod 775 command the movie could be viewed but for each movie it's very complex to do this.

And every file/movie has another name (with date and time stamp).
See script below.

What's the solution for this?

Thanks for the help and kind regards,

John


Code: Select all

#!/usr/bin/python

from time import sleep
from datetime import datetime
from picamera import PiCamera

camera = PiCamera()

timestamp = datetime.now().strftime("%d-%m-%y_%H:%M:%S")
camera.start_recording("/home/pi/Videos/Motion/{}.h264".format(timestamp))
sleep(20)
camera.stop_recording()

Re: Domoticz runs Python script as root, result is denied for normal user

Posted: Monday 24 December 2018 14:37
by ledfreak3d
i have the feeling domoticz does this for more then python scripts alone

Re: Domoticz runs Python script as root, result is denied for normal user

Posted: Monday 24 December 2018 22:24
by freijn
dirty, i know but

do a chown in the python ( as you know the filename there)