Home of the Squeezebox™ & Transporter® network music players.
Page 40 of 40 FirstFirst ... 30383940
Results 391 to 396 of 396
  1. #391
    Senior Member Jeff07971's Avatar
    Join Date
    Aug 2011
    Location
    London, England
    Posts
    1,059
    You could connect a button on GPIO to do this too.
    Out of interest is there a thread on how to do this ?

    Hopefilly not as complex as the Audiophonics way

    Jeff
    Players: SliMP3,Squeezebox3 x3,Receiver,SqueezeLiteX,PiCorePlayer x3,Wandboard
    Server: LMS Version: Latest Nightly on Centos 7 VM on ESXi 6.5.0U1 on Dell T320
    Plugins: AutoRescan/BBCiPlayer/PowerSave/PowerSwitchIII/Squeezecloud/Spotty/Player Groups
    Remotes: iPeng9/Orangesqueeze/PC/Jivelite/SqueezeLiteX
    Music: 522GB,1660 albums with 23087 songs by 5204 artists mostly FLACs

    Want a webapp ? See http://forums.slimdevices.com/showth...Webapp-for-LMS

  2. #392
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    1,211
    Take a look in the home directory, there should be a script called

    pcp-powerbutton.sh

    Connect a button to any GPIO pin, but GPIO 17 is default
    (Pardon the crude sketch)
    Name:  Capture.PNG
Views: 103
Size:  102.4 KB

    Then put this command on the tweaks page. Full usage of the command is in the script.

    Name:  Capture2.PNG
Views: 102
Size:  8.6 KB
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://sites.google.com/site/picoreplayer/home

    Please donate if you like the piCorePlayer

  3. #393
    Senior Member Jeff07971's Avatar
    Join Date
    Aug 2011
    Location
    London, England
    Posts
    1,059
    Hi Paul-

    Thanks for that !

    (Pardon the crude sketch)
    I know Doc you did'nt have time to paint or scale it (Back To The Future 3)

    Jeff
    Players: SliMP3,Squeezebox3 x3,Receiver,SqueezeLiteX,PiCorePlayer x3,Wandboard
    Server: LMS Version: Latest Nightly on Centos 7 VM on ESXi 6.5.0U1 on Dell T320
    Plugins: AutoRescan/BBCiPlayer/PowerSave/PowerSwitchIII/Squeezecloud/Spotty/Player Groups
    Remotes: iPeng9/Orangesqueeze/PC/Jivelite/SqueezeLiteX
    Music: 522GB,1660 albums with 23087 songs by 5204 artists mostly FLACs

    Want a webapp ? See http://forums.slimdevices.com/showth...Webapp-for-LMS

  4. #394
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    1,211
    Was the script on your system? I just realized that the input --low option didn't work for a push button. It was originally setup for the audiophonics board. Using inputs as low is much safer......less chance of connecting voltage to the wrong pin.

    So here is the fixed script.

    Code:
    #!/bin/sh
    #
    # piCorePlayer Power Button Script - Used to shutdown pCP with a GPIO input.
    #
    #	Version 1.1 2018-06-24
    #		Bug fix for --low
    #
    #
    #  Defaults are for the Audiophonics power button
    DEBUG=0
    IN_LOW=0
    PIN_IN=17
    PIN_OUT=22
    PUPDOWN="off"
    
    PATH=/bin:/usr/bin:/usr/local/bin
    
    usage() {
    	echo "  usage: $0 [-i] [-o] [--low] [--help] [--debug]"
    	echo "            -i        GPIO input pin to shutdown pCP"
    	echo "            -o        GPIO output pin for successful pCP boot"
    	echo "            --low     Input is active low (and set pull up resistor)"
    	echo "            --high    Input is active high (and set pull down resistor)"
    	echo "            --debug   Script run as normal, but will not shutdown pCP"
    	echo "            --help    script usage"
    	echo ""
    	echo "            Note: pin numbers are in BCM notation"
    	echo ""
    	exit 1
    }
    
    validate_pin(){
    	VAL=$(echo $1 | grep -o '[[:digit:]]*')
    
    	if [ "$VAL" != "" ]; then
    		if [ $VAL -le 31 ]; then
    			return 0
    		fi
    	fi
    	return 1
    }
    
    O=$(/usr/bin/getopt -al help,low,high,debug -- i:o:h "$@") || exit 1
    eval set -- "$O"
    
    [ "$1" = "--" ] && echo "No command line settings, Using defaults"; echo ""
    
    while true; do
    	case "$1" in
    		-i) PIN_IN=$2; shift;;
    		-o) PIN_OUT=$2; shift;;
    		--debug) DEBUG=1;;
    		--low) IN_LOW=1; PUPDOWN="up";;
    		--high) IN_LOW=0; PUPDOWN="down";;
    		--help) usage;;
    		--) shift; break;;
    		-*) usage;;
    		*) break;;
    	esac
    	shift
    done
    
    echo "piCorePlayer Power button shutdown script starting..."
    
    validate_pin $PIN_IN
    if [ $? -ne 0 ]; then
    	echo "Error in Input Pin Assignment"
    	exit 1
    fi
    validate_pin $PIN_OUT
    if [ $? -ne 0 ]; then
    	echo "Error in Output Pin Assignment"
    	exit 1
    fi
    
    echo "Asserting pins : "
    echo -n "ShutDown : GPIO${PIN_IN}=in, "
    [ ${IN_LOW} -eq 1 ] && echo "Low" || echo "High"
    echo "BootOK   : GPIO${PIN_OUT}=out, High"
    
    gpio -g mode $PIN_IN in
    gpio -g mode $PIN_IN $PUPDOWN
    gpio -g mode $PIN_OUT out
    gpio -g write $PIN_OUT 1
    
    [ $IN_LOW -eq 0 ] && IN_CHK=1 || IN_CHK=0
    
    while [ 1 ]; do
      if [ "$(/usr/local/bin/gpio -g read ${PIN_IN})" = "$IN_CHK" ]; then
            echo "piCorePlayer shutting down."
            [ $DEBUG -eq 0 ] && sudo /sbin/poweroff
            break
      fi
      /bin/sleep 1
    done
    
    exit 0
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://sites.google.com/site/picoreplayer/home

    Please donate if you like the piCorePlayer

  5. #395
    Senior Member Jeff07971's Avatar
    Join Date
    Aug 2011
    Location
    London, England
    Posts
    1,059
    Hi Paul-

    Yup, Script was on all my Pcp's

    Modified as per your post seems to work fine !

    Code:
    tc@piCorePlayer:~$ /home/tc/pcp-powerbutton.sh -i 5 -o 6 --low --debug
    
    piCorePlayer Power button shutdown script starting...
    Asserting pins :
    ShutDown : GPIO5=in, Low
    BootOK   : GPIO6=out, High
    piCorePlayer shutting down.
    tc@piCorePlayer:~$ /home/tc/pcp-powerbutton.sh -i 5 -o 6 --low
    
    piCorePlayer Power button shutdown script starting...
    Asserting pins :
    ShutDown : GPIO5=in, Low
    BootOK   : GPIO6=out, High
    piCorePlayer shutting down.
    tc@piCorePlayer:~$
    Thanks

    Jeff
    Players: SliMP3,Squeezebox3 x3,Receiver,SqueezeLiteX,PiCorePlayer x3,Wandboard
    Server: LMS Version: Latest Nightly on Centos 7 VM on ESXi 6.5.0U1 on Dell T320
    Plugins: AutoRescan/BBCiPlayer/PowerSave/PowerSwitchIII/Squeezecloud/Spotty/Player Groups
    Remotes: iPeng9/Orangesqueeze/PC/Jivelite/SqueezeLiteX
    Music: 522GB,1660 albums with 23087 songs by 5204 artists mostly FLACs

    Want a webapp ? See http://forums.slimdevices.com/showth...Webapp-for-LMS

  6. #396
    Senior Member
    Join Date
    May 2008
    Location
    United States
    Posts
    11,215
    Quote Originally Posted by paul- View Post
    If you are using the pCP device as the LMS server, it is best to do a shutdown or halt. The only reason it should be done, is that LMS updates it cache files.

    There is a shutdown button on the web interface for pcp.... This can also be done from a shell with the command "pcp sd"

    You could connect a button on GPIO to do this too.
    Thanks.
    Home: VortexBox 4TB (2.4) > LMS 7.9.1 > Transporter, Touch, Boom, Radio (all ethernet)
    Cottage: VBA 3TB (2.4) > LMS 7.9.1 > Touch > Benchmark DAC I, Boom, Radio w/Battery (all ethernet except Radio)
    Office: Win8(64) > LMS 7.9.1 > Squeezelite
    Spares: Transporter, Touch(3), Radio(3), Boom, SB3, CONTROLLER
    Controllers: iPhone6 & iPadAir2 (iPeng & Squeezepad), CONTROLLER, or SqueezePlay 7.8 on Win10(64) laptop
    Files: ripping: dbpoweramp > FLAC; post-rip: mp3tag, PerfectTunes; Streaming: Spotify

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •