kolossos4730 wrote:
> Greg,
>
> I modified your script to allow unmuting/muting of the Pi-AMP and
> extended it with one extra variable : FOLLOW_PLAYBACK_STATE.
>
> If FOLLOW_PLAYBACK_STATE<>0 then the script will mute/unmute the amp
> according to the playback state. If FOLLOW_PLAYBACK_STATE=0 then the
> script will just unmute the amp and exit.
>
> I tested this without any speakers attached but the mute status light on
> the amp does reflect the playback state.
Hi kolossos4730, I was hoping you would ask at Pink Fish Media, they are
more DIY than here. ;)
Good start, but I think you need to go back to the original script and
simplify it not add FOLLOW_PLAYBACK_STATE.
The GPIO would follow the status -> mode if you set the DELAYOFF=0 (or
maybe 1), or you could remove the delay code. With the original script
as it was actually turning the amp on and off you didn't want the power
be cut immediately.
Scripts like this need to run with the "while" loop forever. You should
not add code that allows the script to exit, otherwise it will not
monitor squeezelite's status anymore.
Issues that you need to account for, active high or active low, initial
state of GPIO, does the amp expect a pulse to change the mute state or
does the signal need to be held high or low.
I would start with something like this. (UNTESTED)
Code:
--------------------
get_mode() {
RESULT=`( echo "$MAC_ADDR $COMMAND"; echo exit ) | nc $LMS_IP 9090`
echo $RESULT | grep "mode%3Aplay" > /dev/null 2>&1
if [ $? == 0 ]; then
echo "Playing."
echo "1" > /sys/class/gpio/gpio$GPIO/value
else
echo "Stopped."
echo "0" > /sys/class/gpio/gpio$GPIO/value
fi
}
--------------------
regards
Greg
------------------------------------------------------------------------
Greg Erskine's Profile: http://forums.slimdevices.com/member.php?userid=7403
View this thread: http://forums.slimdevices.com/showthread.php?t=97803
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix