Turn SueezeBox Radio off through ssh (no LMS!)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Squeeza
    Member
    • Oct 2021
    • 63

    Turn SueezeBox Radio off through ssh (no LMS!)

    >>> So in this case I am only searching for the shell-command for turning
    >>> the box off (or maybe sleep?) - please see Post #1.

    >>
    >> Why don't you use the web UI?

    >
    > Because I can not enter shell commands there.


    You really don't want to be helped... why are you limited to shell? And
    even if there was a good reason (which you still didn't give us): you
    could use curl from a shell, couldn't you?

    Maybe I should have just said "no way", rather than tried to offer my help?
  • Squeeza
    Member
    • Oct 2021
    • 63

    #2
    WORKS - Turn SqueezeBox Radio off through ssh (no LMS!)

    ------------------------------------------------------------------------------------------------------------------------------------------------

    Conclusion: live-patching of "PlaybackMeta.lua"-File and restart of Squeezeplay! See here Gordon`s Solution

    Short Version
    Code:
    Radio-Firmware v7: ssh -c aes128-cbc -oKexAlgorithms=+diffie-hellman-group1-sha1 root@<IP-Address of SqueezeBox>
    Radio-Firmware v8: ssh root@<IP-Address of SqueezeBox>
    
    Then:
    
    sed -e 's/"on"/"off"/' -i /usr/share/jive/applets/Playback/PlaybackMeta.lua
    /etc/init.d/squeezeplay restart
    Remark: If You leave the state at "off", the Box now always boots to screensaver (Clock, ImageViewer, ... depending on Your settings)
    when it is completely (cold) rebooted.

    ------------------------------------------------------------------------------------------------------------------------------------------------



    Hello,

    how can I turn the SqueezeBox Radio Device off (no shutdown), when I am connected directly to the box via ssh?
    Which shell-command do I have to use?

    I do not want "/sbin/shutdown", "/sbin/reboot" or "/sbin/halt".

    I would like to get the same state as Power-Button or "<mac-Addresse> power 0" (LMS CLI command) does.


    P.S.: The Box is not connected to a LMS
    Last edited by Squeeza; 2022-01-29, 23:34. Reason: remark

    Comment

    • mherger
      Babelfish's Best Boy
      • Apr 2005
      • 24643

      #3
      Turn SueezeBox Radio off through ssh (noLMS!)

      What is the idea behind what you're trying to do? Would an alarm work?
      Or sleep mode?

      I'm not aware of a way to achieve what you want to achieve through SSH.
      But maybe there's an easier way if you can share what you really want to do.
      Michael

      "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
      (LMS: Settings/Information)

      Comment

      • Squeeza
        Member
        • Oct 2021
        • 63

        #4
        Originally posted by mherger
        What is the idea behind what you're trying to do? Would an alarm work?
        Or sleep mode?

        I'm not aware of a way to achieve what you want to achieve through SSH.
        But maybe there's an easier way if you can share what you really want to do.
        Hello Michael

        That would be the easiest way for me.

        I simply want to turn the Box off.
        When a box is beeing rebooted via /sbin/reboot after some Modifications then the Box starts displaying the menu.
        I would like to get the box displaying the screensaver. Maybe that`s the sleep-Mode, yes.

        The only possibility for me to control this box is a ssh-connection.

        Comment

        • mherger
          Babelfish's Best Boy
          • Apr 2005
          • 24643

          #5
          Turn SueezeBox Radio off through ssh (noLMS!)

          > The only possibility for me to control this box is a ssh-connection.

          No access to mysb? Why that limitation?
          Michael

          "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
          (LMS: Settings/Information)

          Comment

          • Squeeza
            Member
            • Oct 2021
            • 63

            #6
            Originally posted by mherger
            > The only possibility for me to control this box is a ssh-connection.

            No access to mysb? Why that limitation?
            I am only the administrator of the box ;-)

            So there is no possibility to do this, am i right?

            I do not think it`s a limitation. Over ssh everything (expect of turning off, at the moment) can be done by cron jobs!
            Last edited by Squeeza; 2022-01-12, 08:16.

            Comment

            • mherger
              Babelfish's Best Boy
              • Apr 2005
              • 24643

              #7
              Turn SueezeBox Radio off through ssh (noLMS!)

              > So there is no possibility to do this, am i right?

              It's hard to give you a good response as you're only giving bits and
              pieces. I still don't understand your use case. When you go to the
              doctor, you don't ask him how to put a stent in place. You tell him what
              your problem is.
              Michael

              "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
              (LMS: Settings/Information)

              Comment

              • Squeeza
                Member
                • Oct 2021
                • 63

                #8
                Originally posted by mherger
                > So there is no possibility to do this, am i right?

                It's hard to give you a good response as you're only giving bits and
                pieces. I still don't understand your use case. When you go to the
                doctor, you don't ask him how to put a stent in place. You tell him what
                your problem is.
                another example:

                I want to list all files in the /etc directory, do You know a shell command for that?
                My answer would be: "No, I do not know one" or "please try ls -lisa /etc" :-)


                So in this case I am only searching for the shell-command for turning the box off (or maybe sleep?) - please see Post #1.

                Comment

                • mherger
                  Babelfish's Best Boy
                  • Apr 2005
                  • 24643

                  #9
                  Turn SueezeBox Radio off through ssh (noLMS!)

                  > So in this case I am only searching for the shell-command for turning
                  > the box off (or maybe sleep?) - please see Post #1.


                  Why don't you use the web UI?
                  Michael

                  "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
                  (LMS: Settings/Information)

                  Comment

                  • Squeeza
                    Member
                    • Oct 2021
                    • 63

                    #10
                    Originally posted by mherger
                    > So in this case I am only searching for the shell-command for turning
                    > the box off (or maybe sleep?) - please see Post #1.


                    Why don't you use the web UI?
                    Because I can not enter shell commands there.

                    Comment

                    • slartibartfast
                      Senior Member
                      • Jan 2010
                      • 13855

                      #11
                      Originally posted by Squeeza
                      Because I can not enter shell commands there.
                      Why do you have to use shell commands? Why are you not using LMS? Why are you not using mysqueezebox.com? If you aren't using LMS or mysqueezebox why are you using a Squeezebox Radio?

                      Sent from my Pixel 3a using Tapatalk
                      Living Room: Touch or Squeezelite (Pi3B) > Topping E30 > Audiolab 8000A > Monitor Audio S5 + BK200-XLS DF
                      Bedroom: Radio
                      Bathroom: Radio

                      Comment

                      • Squeeza
                        Member
                        • Oct 2021
                        • 63

                        #12
                        Wow, very weird here, I see.
                        Simple questions sometimes only wants simple answers. But that`s very hard to understand - sometimes.

                        As I said: A "No, unfortunately there is no command." would have been enough and less time-wasting.


                        Thanks for all Your help. Please consider this question as aswered here!
                        Please do not be angry, ok!

                        I am not, too!

                        Comment

                        • gordonb3
                          Senior Member
                          • Dec 2020
                          • 489

                          #13
                          Seems to me that your question is badly formulated.

                          Reading your second post in this thread I think that it is your objective for the Radio to boot into standby mode rather than showing the menu and depending on settings even playing music. I can relate to that as it is also one of my annoyances to sometimes find the Radio on when returning from a holiday.

                          The following commit is probably of interest to you:
                          Code:
                          diff --git a/src/squeezeplay/share/applets/Playback/PlaybackMeta.lua b/src/squeezeplay/share/applets/Playback/PlaybackMeta.lua
                          index d4c0018a1..6f8c01645 100644
                          --- a/src/squeezeplay/share/applets/Playback/PlaybackMeta.lua
                          +++ b/src/squeezeplay/share/applets/Playback/PlaybackMeta.lua
                          @@ -101,13 +101,9 @@ function configureApplet(meta)
                           	end
                           	--must defer this since skin isn't loaded yet
                           	jiveMain:registerPostOnScreenInit(      function()
                          -							--always start on, unless was unclean shutdown, then start up with saved state
                          -							if appletManager:callService("wasLastShutdownUnclean") then
                          -								log:info("Last shutdown was unclean, restarting with previous soft power state: ", settings.powerState)
                          -								jiveMain:setSoftPowerState(settings.powerState)
                          -							else
                          -								jiveMain:setSoftPowerState("on")
                          -							end
                          +							--Bug 16593: always start on, even if soft power state was off when shutdown
                          +							-- this is to avoid a situation where a Radio powers up to a black screen (fallback whenOff SS when clock is not set)
                          +							jiveMain:setSoftPowerState("on")
                           						end)
                           	
                           	-- Connect player
                          Shamefully the original bug tracker is gone and so I'm not really sure how the comment needs to be interpreted, i.e. whether the bug manifests itself when you've set a different screensaver than clock, or when the clock is at 1970-01-01. Either way you can try toggle the default state to 'off' and see if the bug affects you.

                          Comment

                          • Squeeza
                            Member
                            • Oct 2021
                            • 63

                            #14
                            Originally posted by gordonb3
                            Seems to me that your question is badly formulated.
                            Yeah, You may be right. Many thanks for successfully trying to understand my question!

                            The "jive"-Command could be my solution! Thanks for showing this possibility.
                            At the moment I do not know how to use it correctly but I will try to find some documentation!

                            MANY THANKS, Gordon!

                            Comment

                            • gordonb3
                              Senior Member
                              • Dec 2020
                              • 489

                              #15
                              Originally posted by Squeeza
                              Yeah, You may be right. Many thanks for successfully trying to understand my question!

                              The "jive"-Command could be my solution! Thanks for showing this possibility.
                              At the moment I do not know how to use it correctly but I will try to find some documentation!
                              Don't think that will work. Jive is the main squeezeplay process and starting a second will most likely not allow you to change states in the already running instance. It is possible to restart the squeezeplay service though, so to switch Radio to standby you could run something like:
                              Code:
                              sed -e 's/"on"/"off"/' -i /usr/share/jive/applets/Playback/PlaybackMeta.lua
                              /etc/init.d/squeezeplay restart
                              
                              #restore original setting
                              sleep 5
                              sed -e 's/"off"/"on"/' -i /usr/share/jive/applets/Playback/PlaybackMeta.lua

                              Comment

                              Working...