Bash Script Problem on a Pi Running Domoticz 4.11488

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
alarm_guy1
Posts: 132
Joined: Tuesday 14 January 2014 0:03
Target OS: Linux
Domoticz version:
Contact:

Bash Script Problem on a Pi Running Domoticz 4.11488

Post by alarm_guy1 »

Hi guys,

I have a simple bash script, in domoticz/scripts/doorbell.sh

Code: Select all

#!/bin/sh
sudo aplay ~/doorbell-1.wav &
exit 0
It has the rights 777

and if I run sh doorbell.sh from within domoticz/scripts/doorbell.sh my Pi plays the doorbell-1.wav no issues

I have a switch in Domoticz that I can manually turn on and off.(Pic attached)
and refers to the Bash script
When I toggle the switch nothing, no sound nothing.
The log reads as follows
2019-11-29 19:54:32.854 (Esp Wifi 1) Light/Switch (test GPIO 5)
2019-11-29 19:54:32.842 Status: User: Admin initiated a switch command (283/test GPIO 5/On)
2019-11-29 19:54:33.073 Status: Executing script: /home/pi/domoticz/scripts/doorbell.sh
2019-11-29 19:54:34.367 (domoticz) General/kWh (Kitchen Lights kWh Meter)
2019-11-29 19:54:34.405 (domoticz) Usage (Kitchen Lights Watts 1)
2019-11-29 19:54:34.412 (domoticz) General/kWh (Kitchen Lights kWh Meter)
2019-11-29 19:54:34.442 (Esp Wifi 1) Light/Switch (test GPIO 5)
2019-11-29 19:54:34.433 Status: User: Admin initiated a switch command (283/test GPIO 5/Off)
2019-11-29 19:54:35.178 (domoticz) General/kWh (Kitchen Lights kWh Meter)

I have no idea where to go with this as it appears to be working in Domoticz but no sound and def. works from the command line

Any help greatly appreciated
Attachments
Untitled.jpg
Untitled.jpg (118.38 KiB) Viewed 412 times
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Bash Script Problem on a Pi Running Domoticz 4.11488

Post by waaren »

waaren wrote: Saturday 30 November 2019 0:37
alarm_guy1 wrote: Friday 29 November 2019 20:57 I have no idea where to go with this as it appears to be working in Domoticz but no sound and def. works from the command line
Can you try with the full qualified scriptname ? So something like script:///home/pi/domoticz/scripts/doorbell.sh
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
alarm_guy1
Posts: 132
Joined: Tuesday 14 January 2014 0:03
Target OS: Linux
Domoticz version:
Contact:

Re: Bash Script Problem on a Pi Running Domoticz 4.11488

Post by alarm_guy1 »

Thanks for the quick reply,
Unfortunately that made no difference, other than stating it was working ok and executing the script.

It is like Domoticz doesn't have rights to the sound card or similar
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Bash Script Problem on a Pi Running Domoticz 4.11488

Post by waaren »

alarm_guy1 wrote: Saturday 30 November 2019 2:30 It is like Domoticz doesn't have rights to the sound card or similar
Or maybe (the user executing) domoticz does not recognize the aplay command or cannot find the wav file.
Please try with full qualified aplay command and parm (something like sudo /usr/bin/play /home/pi/doorbell-1.wav & ) as the env maybe different for domoticz.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
alarm_guy1
Posts: 132
Joined: Tuesday 14 January 2014 0:03
Target OS: Linux
Domoticz version:
Contact:

Re: Bash Script Problem on a Pi Running Domoticz 4.11488 [SOLVED]

Post by alarm_guy1 »

Many many thanks

works a treat
cheers

Just added the line as you said and BOOM

sudo /usr/bin/play /home/pi/doorbell-1.wav &
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest