After WiFi is powered down; sound is muted - Jasky - 03-21-2025
Hi,
I have a multi room set up. The sender and receivers are all RPi 4.
Moode version: 9.0.0
I turn my wifi off whilst I sleep, the wifi is off until 6am. When I wake and hit play on some music it's muted by default. I need to go into the receivers in the ui (img attached) and toggle the check boxes to get the sound to unmute.
Ideally, I'm after a way of doing this action programmatically, so I can fire that on a cron in the morning. What is the best way to toggle that mute action without resorting to beautiful soup (parsing the html). The relevant logs to that action are the last few lines (I think) from the debug log below.
Code: 20250321 060059 DEBUG: startSpotify(): (librespot --name "All Spotify" --bitrate 320 --format S16 --mixer softvol --initial-volume 100 --volume-ctrl log --volume-range 60 --cache /var/local/www/spotify_cache --disable-audio-cache --backend alsa --device "_audioout" --onevent /var/local/www/commandw/spotevent.sh -v > /var/log/moode_librespot.log 2>&1 &)
20250321 060109 watchdog: Started Spotify Connect after crash detected
20250321 060109 updReceiverVol(): -set-mpdvol -restore: hall failed
20250321 060109 updReceiverVol(): -set-mpdvol -restore: kitchen failed
20250321 060109 updReceiverVol(): -set-mpdvol -restore: livingroom failed
20250321 060113 DEBUG: startSpotify(): (librespot --name "All Spotify" --bitrate 320 --format S16 --mixer softvol --initial-volume 100 --volume-ctrl log --volume-range 60 --cache /var/local/www/spotify_cache --disable-audio-cache --backend alsa --device "_audioout" --onevent /var/local/www/commandw/spotevent.sh -v > /var/log/moode_librespot.log 2>&1 &)
20250321 060123 watchdog: Started Spotify Connect after crash detected
20250321 060124 DEBUG: updReceiverVol(): -set-mpdvol -restore: hall success
20250321 060124 DEBUG: updReceiverVol(): -set-mpdvol -restore: kitchen success
20250321 060127 updReceiverVol(): -set-mpdvol -restore: livingroom failed
20250321 060131 DEBUG: startSpotify(): (librespot --name "All Spotify" --bitrate 320 --format S16 --mixer softvol --initial-volume 100 --volume-ctrl log --volume-range 60 --cache /var/local/www/spotify_cache --disable-audio-cache --backend alsa --device "_audioout" --onevent /var/local/www/commandw/spotevent.sh -v > /var/log/moode_librespot.log 2>&1 &)
20250321 065346 worker: Maintenance: Warning: Problem clearing system logs
20250321 065346 worker: Maintenance: /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_GB.UTF-8)
20250321 065347 DEBUG: Maintenance completed
20250321 085810 DEBUG: chkVariables(): Excluded key: path
20250321 085815 DEBUG: multiroom.php: get_rx_status: hall rx,On,100,0,1,hall,239.0.0.1
20250321 085816 DEBUG: multiroom.php: get_rx_status: kitchen rx,On,100,0,1,kitchen,239.0.0.1
20250321 085816 DEBUG: multiroom.php: get_rx_status: livingroom rx,On,100,0,1,livingroom,239.0.0.1
20250321 085821 multiroom.php: set_rx_status onoff failed: hall
20250321 085822 multiroom.php: set_rx_status onoff failed: kitchen
20250321 085823 multiroom.php: set_rx_status onoff failed: livingroom
20250321 085824 multiroom.php: set_rx_status onoff failed: hall
20250321 085824 multiroom.php: set_rx_status onoff failed: kitchen
20250321 085825 multiroom.php: set_rx_status onoff failed: livingroom
This project is hands down one of my favourite opensource projects I've come across. So impressive, I can't give my thanks to all the contributors enough.
Thanks for any help,
Jasky
RE: After WiFi is powered down; sound is muted - Tim Curtis - 03-22-2025
Its undocumented but try these REST API commands for controlling the receiver
Code: http://HOSTNAME_OR_IPADDRESS/command/?cmd=trx_control -rx Off
http://HOSTNAME_OR_IPADDRESS/command/?cmd=trx_control -rx On
# Maybe a delay between them is needed if running consecutively ?
A cURL version is below - not tested but should work.
Code: curl -G -S -s --data-urlencode "cmd=trx_control -rx Off" http://HOSTNAME_OR_IPADDRESS/command/
The file that receives them is /var/www/command/index.php
The file that executes them is /var/www/util/trx-control.php
RE: After WiFi is powered down; sound is muted - Jasky - 03-25-2025
(03-22-2025, 01:24 AM)Tim Curtis Wrote: Its undocumented but try these REST API commands for controlling the receiver
Code: http://HOSTNAME_OR_IPADDRESS/command/?cmd=trx_control -rx Off
http://HOSTNAME_OR_IPADDRESS/command/?cmd=trx_control -rx On
# Maybe a delay between them is needed if running consecutively ?
A cURL version is below - not tested but should work.
Code: curl -G -S -s --data-urlencode "cmd=trx_control -rx Off" http://HOSTNAME_OR_IPADDRESS/command/
The file that receives them is /var/www/command/index.php
The file that executes them is /var/www/util/trx-control.php
Thanks for the speedy reply Tim. That API does the trick and I didn't need to add a delay between the calls. I run this daily using a systemd timer, here's the code for anyone who finds themselves needing it in the future:
Code: #!/bin/bash
set -e
set -o pipefail
HALL=192.168.xxx.yyy
LIVING_ROOM=192.168.xxx.yyy
KITCHEN=192.168.xxx.yyy
SERVERS=($HALL $LIVING_ROOM $KITCHEN)
for server in "${SERVERS[@]}"; do
curl -G -S -s --data-urlencode "cmd=trx_control -rx Off" "http://$server/command/"
curl -G -S -s --data-urlencode "cmd=trx_control -rx On" "http://$server/command/"
done
exit 0
|