script is executed . . . but !
Posted: Tuesday 21 January 2020 15:43
I have a virtual switch that starts a script when it is on and starts a script when it is off.
on : script://BTmusic/badkamer1.sh
off : script://BTmusic/badkamer1s.sh
Pressing the switch on the script is executed according to the log and pressing it off also the other script.
2020-01-21 15:21:45.170 Status: Executing script: /home/onshuis/Domotica/domoticz/scripts/BTmusic/badkamer1.sh
2020-01-21 15:21:51.730 (Virtueel) Light/Switch (Badkamer1)
2020-01-21 15:21:51.717 Status: User: Admin initiated a switch command (189/Badkamer1/Off)
2020-01-21 15:21:51.934 Status: Executing script: /home/onshuis/Domotica/domoticz/scripts/BTmusic/badkamer1s.sh
Now it needs to play to a bluetooth speaker, inside the script badkamer1.sh is this:
When i press the virtual button from the website it plays nothing also mplayer is not even started.
When i ssh into the domoticz pc and start badkamer1.sh manually it plays to the bluetooth speaker. Then when i press the virtual button to off. The second script is executed and the music stops. So this is working.
off script contents:
The user and group that domoticz is started is the same i use to ssh into the pc. I have also other scripts that work correctly.
Then I stop the domoticz service when ssh connected. Then i manually start domoticz with domoticz start, i go to the website click the switch to on, the script is executed and music comes out of the bluetooth speaker. This is so weird to me, what am i missing or doing wrong ???
I used the preferred way, according to the wiki, to start domoticz with systemd.
First guess would be permissions but the group and user that domoticz starts is the same user if i start it manually by ssh, i tried different users and root, but no result.
I am very new to linux, there a lot of things i do not understand. I tried searching the internet for solutions, but i do not seem to find any. I tried a lot of things, but they are more or less how to pair and connect to bluetooth speaker and this works automatically.
Could someone please tell me what i am doing wrong?
This is my setup where domoticz runs on:
on : script://BTmusic/badkamer1.sh
off : script://BTmusic/badkamer1s.sh
Pressing the switch on the script is executed according to the log and pressing it off also the other script.
2020-01-21 15:21:45.170 Status: Executing script: /home/onshuis/Domotica/domoticz/scripts/BTmusic/badkamer1.sh
2020-01-21 15:21:51.730 (Virtueel) Light/Switch (Badkamer1)
2020-01-21 15:21:51.717 Status: User: Admin initiated a switch command (189/Badkamer1/Off)
2020-01-21 15:21:51.934 Status: Executing script: /home/onshuis/Domotica/domoticz/scripts/BTmusic/badkamer1s.sh
Now it needs to play to a bluetooth speaker, inside the script badkamer1.sh is this:
Code: Select all
/usr/bin/mplayer -ao pulse::bluez_sink.00_XX_XX_XX_XX_1F.a2dp_sink "/home/onshuis/Domotica/domoticz/scripts/BTmusic/music/relax1.mp3" -noconsolecontrols -softvol -volume 85 > /dev/null 2>&1
When i ssh into the domoticz pc and start badkamer1.sh manually it plays to the bluetooth speaker. Then when i press the virtual button to off. The second script is executed and the music stops. So this is working.
off script contents:
Code: Select all
pkill -STOP mplay > /dev/null &
Then I stop the domoticz service when ssh connected. Then i manually start domoticz with domoticz start, i go to the website click the switch to on, the script is executed and music comes out of the bluetooth speaker. This is so weird to me, what am i missing or doing wrong ???
I used the preferred way, according to the wiki, to start domoticz with systemd.
First guess would be permissions but the group and user that domoticz starts is the same user if i start it manually by ssh, i tried different users and root, but no result.
I am very new to linux, there a lot of things i do not understand. I tried searching the internet for solutions, but i do not seem to find any. I tried a lot of things, but they are more or less how to pair and connect to bluetooth speaker and this works automatically.
Could someone please tell me what i am doing wrong?
This is my setup where domoticz runs on:
- Spoiler: show