Page 2 of 2
Re: Lua script executing sh script... not working!
Posted: Friday 23 March 2018 16:18
by echeberri77
echeberri77 wrote:jannl wrote:The path ezsynth inside the script. The script itself is executed as shown in the Domoticz log
Ok, I'll adding complete path. I'll let you know. Thanks!
Inviato dal mio MHA-L29 utilizzando Tapatalk
Found the First issue: i played for the First time the welcome audio message using izsynth and the root user. When playback occurs an mp3 file is created and It Will be played for the next times... But if you playback It for the First time with root user It Will be only "root readable" with no permissions for other... I saw the izsynth log and I found that playback occurs correctly only if root user launch the Command... Is any other user launch that izsynth string Will receive a read permission Denied! I changed permissions in that mp3 file and not It is possible to hear It when played by a non root user. Domoticz however still mute on playing It.
..There must ne something else...
Inviato dal mio MHA-L29 utilizzando Tapatalk
Re: Lua script executing sh script... not working!
Posted: Friday 23 March 2018 22:01
by echeberri77
Still not working!
I added into the sh file the complete path as suggested:
Code: Select all
#!/bin/bash
/home/xavier/Documenti/izsynth-master/izsynth -e naturalreaders -v Federica -t "Luci del corridoio accese"
I also tried to delete cached mp3 file and let domoticz creates itself by executing che script. The mp3 file is corrected created (by domoticz triggering) but I am not able to hear any sound!
It's crazy....
Re: Lua script executing sh script... not working!
Posted: Friday 23 March 2018 23:12
by DennisD
Maybe unrelated , but i encounter the same issue with a script (bash file) which i call in a blocky
Re: Lua script executing sh script... not working!
Posted: Saturday 24 March 2018 14:48
by jvandenbroek
Supplying full path in script should work, but keep in mind that if the called path itself calls other binaries, it might not work. Try including PATH=/usr/local/bin:/usr/bin etc, make sure that all paths are included.
Re: Lua script executing sh script... not working!
Posted: Saturday 24 March 2018 15:01
by echeberri77
jvandenbroek wrote:Supplying full path in script should work, but keep in mind that if the called path itself calls other binaries, it might not work. Try including PATH=/usr/local/bin:/usr/bin etc, make sure that all paths are included.
Still not working.
I tried to change into izsynth configuration the path where mp3 are stored once created. Then I asked domoticz di launch a new sound message creating in this way a new mp3 audio into the new path. If i look to this file permissions settings I Can see that root created It... It means domoticz uses root priviledges to launch script.
I still however have the problem: no audio. If i launch from a terminal the sh batch (using both a root and a no-root user) i cani correctly hear sound!!!
If It would be a path issue I shouldn't be able to hear sound when launching sh from terminal too.
I am really confused.
Inviato dal mio MHA-L29 utilizzando Tapatalk
Re: Lua script executing sh script... not working!
Posted: Sunday 25 March 2018 8:28
by echeberri77
Let me sum up it all again.
Into my domoticz system I have this dummy light switch:
Code: Select all
Turn On 13 SonOff_corridoio A 1 Luci corridoio Lighting 1 X10 Off
This switch is used to command my sonoff and in particular it switchs on a light. If I push the software button I can switch lamp ON.
In my domoticz directory
(I have these scripts):
script_device_lucicorridoiovoice.lua
Code: Select all
commandArray = {}
if (devicechanged['Luci corridoio'] == 'On') then
os.execute ('/home/xavier/domoticz/scripts/luci_corridoio.sh &')
end
return commandArray
luci_corridoio.sh
Code: Select all
#!/bin/bash
/home/xavier/domoticz/scripts/izsynth -e naturalreaders -v Federica -t "Luci del corridoio accese"
Into this script directory I also copied izsynth executable.
All files inside script directory are chmod +x and chmod 777.
User used by domoticz to launch to execute script is root user.
If I trigger luci_corridoio.sh with domoticz lighting button it correctly creates the mp3 sound file (it means it is able to correctly launch izsynth).
Let's start all from the beginning. Any idea?
Re: Lua script executing sh script... not working!
Posted: Sunday 25 March 2018 8:49
by jannl
Read the posts regarding the path settings.
Make sure all path settings and environment settings are the same in the command line and in the script. They are different depending on the way the script is started. Either direct from commandline or via Domoticz. This is linux, not windows.
Redirecting set and/or setenv to a file in the scripts helps to debug the differences.
Re: Lua script executing sh script... not working!
Posted: Sunday 25 March 2018 9:29
by echeberri77
jannl wrote: ↑Sunday 25 March 2018 8:49
Redirecting set and/or setenv to a file in the scripts helps to debug the differences.
Could you please help me doing this?
Thanks!
Re: Lua script executing sh script... not working!
Posted: Sunday 25 March 2018 9:40
by echeberri77
I added log to che lua script execution.
script_device_lucicorridoio.lua
Code: Select all
commandArray = {}
if (devicechanged['Lucicorridoio'] == 'On') then
os.execute ('/home/xavier/domoticz/scripts/Lucicorridoio.sh>/home/xavier/domoticz/scripts/log/lua.log')
end
return commandArray
This is the content of lua.log after switch ON (and mp3 file is alredy present on script directory):
Code: Select all
================================================================================
[2C [1/1] - izsynth Name:[Luci_del_corridoio_accese-1641778200]
File exist - input:[/home/xavier/domoticz/scripts/Luci_del_corridoio_accese-1641778200.mp3]
Playing - input:[/home/xavier/domoticz/scripts/Luci_del_corridoio_accese-1641778200.mp3] command:[mplayer] options:[ -quiet -nolirc -noconsolecontrols -afm mp3lib,ffmpeg]
--------------------------------------------------------------------------------
[2C [1/1]
This is the content of lua.log in case mp3 is not yet present:
Code: Select all
[2C [1/1] - izsynth Name:[Luci_del_corridoio_accese-1641778200]
Synthesizing - input:[/home/xavier/domoticz/scripts/izsynth-20180325-094039/Luci_del_corridoio_accese-1641778200.txt] engine:[naturalreaders] voice:[Federica] output:[/home/xavier/domoticz/scripts/Luci_del_corridoio_accese-1641778200.mp3] size:[20K] type:[audio/mpeg] result:[SUCCESS]
Playing - input:[/home/xavier/domoticz/scripts/Luci_del_corridoio_accese-1641778200.mp3] command:[mplayer] options:[ -quiet -nolirc -noconsolecontrols -afm mp3lib,ffmpeg]
--------------------------------------------------------------------------------
[2C [1/1]
Err...it doesn't tell me so much....From what I can read mp3 file is correctly played.....hmmmmm
Re: Lua script executing sh script... not working!
Posted: Sunday 25 March 2018 10:12
by jannl
Hm. I agree. Looks like it is working. Not sure if it is a volume issue. Can you set the volume from the script?
set > filename.log sends the output of set toba file. Same for setenv
Re: Lua script executing sh script... not working!
Posted: Sunday 25 March 2018 10:41
by echeberri77
jannl wrote: ↑Sunday 25 March 2018 10:12
Hm. I agree. Looks like it is working. Not sure if it is a volume issue. Can you set the volume from the script?
set > filename.log sends the output of set toba file. Same for setenv
Err...I don't really know how to do that. Could you explain please?
Re: Lua script executing sh script... not working!
Posted: Sunday 25 March 2018 10:47
by jannl
What do mean?
If you mean set > filename.log. add that to the log and replace filename.log with a path and filename the user the script runs under has write rights.
Re: Lua script executing sh script... not working!
Posted: Sunday 25 March 2018 10:54
by echeberri77
I forced volume 100 (the maximum) to izsynth arguments. This is content of lua.log:
Code: Select all
================================================================================
[2C [1/1] - izsynth Name:[Luci_del_corridoio_accese-1203338941]
File exist - input:[/home/xavier/domoticz/scripts/Luci_del_corridoio_accese-1203338941.44khz.wav]
Playing - input:[/home/xavier/domoticz/scripts/Luci_del_corridoio_accese-1203338941.44khz.wav] command:[mplayer] options:[ -quiet -nolirc -noconsolecontrols -afm mp3lib,ffmpeg -ao alsa -volume 100]
--------------------------------------------------------------------------------
[2C [1/1]
Re: Lua script executing sh script... not working!
Posted: Sunday 25 March 2018 10:59
by jannl
Looks like an error in the script or calling the script
Re: Lua script executing sh script... not working!
Posted: Sunday 25 March 2018 10:59
by jannl
Debugging in linux can be a pain in the ass
Re: Lua script executing sh script... not working!
Posted: Sunday 25 March 2018 11:00
by echeberri77
jannl wrote: ↑Sunday 25 March 2018 10:59
Looks like an error in the script or calling the script
It was my mistake: a missing " at the end of a line. Now fixed.
Re: Lua script executing sh script... not working!
Posted: Sunday 25 March 2018 15:46
by echeberri77
Still no luck.
I don't really know what to check at this point....
Re: Lua script executing sh script... not working!
Posted: Tuesday 27 March 2018 9:37
by echeberri77
echeberri77 wrote:Still no luck.
I don't really know what to check at this point....
During these days i had the chance to try another vocal synthetizer and I am having the same issue: no output audio. It seems to be a sound card output problem. Domoticz seems unable to use the correct sound card for output...
Any suggestion?
Inviato dal mio MHA-L29 utilizzando Tapatalk
Re: Lua script executing sh script... not working!
Posted: Tuesday 27 March 2018 15:47
by echeberri77
Re: Lua script executing sh script... not working!
Posted: Saturday 31 March 2018 10:16
by jannl
This is probably because during installation some settings where made taking care of using the correct output as a default.
Thisis why I told you to investigate that. During script execution in this way the normal user settings are not present. The same counts for instance for crontab scripts.
Jan