Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 6 of 6
  1. #1
    Junior Member
    Join Date
    Jul 2020
    Posts
    2

    Sending commands to LMS via iOS app shortcuts

    Hello everybody,

    beginner here with just some basic knowledge of coding, so please bear with me.

    From what I read online there is an API for the LMS that can be interacted with via Json. You can even find the documentation online with several different commands.

    What I would like to make are different shortcuts I can use on my phone. For the start for example to activate standby for one of my squeezeboxes. Problem is I don’t know how the syntax has to be to make it work.

    For standby the command according to CLI documentation would be <playerid> power <0|1|?|>

    If somebody can show me the coding for standby, that would greatly help me. If it is even possible.

    Thanks in advance guys

  2. #2
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,437

    Sending commands to LMS via iOS appshortcuts

    > What I would like to make are different shortcuts I can use on my phone.
    > For the start for example to activate standby for one of my
    > squeezeboxes. Problem is I donÂ’t know how the syntax has to be to make
    > it work.


    You'll have to send a POST request to http://yourlms:9000/jsonrpc.js (or
    whatever the port and/or host it is you're using). I'm not sure you can
    do this with shortcuts, I'm not familiar with it. You'd have to ask this
    else where.

    > For standby the command according to CLI documentation would be
    > <playerid> power <0|1|?|>


    The body for this request would be:

    {"id":0,"params":["00:04:20:...",["power", 1]],"method":"slim.request"}

    Where you put the player's MAC address instead of 00:04:20....

    --

    Michael

  3. #3
    Junior Member
    Join Date
    Jul 2020
    Posts
    2
    Quote Originally Posted by mherger View Post
    > What I would like to make are different shortcuts I can use on my phone.
    > For the start for example to activate standby for one of my
    > squeezeboxes. Problem is I donÂ’t know how the syntax has to be to make
    > it work.


    You'll have to send a POST request to http://yourlms:9000/jsonrpc.js (or
    whatever the port and/or host it is you're using). I'm not sure you can
    do this with shortcuts, I'm not familiar with it. You'd have to ask this
    else where.

    > For standby the command according to CLI documentation would be
    > <playerid> power <0|1|?|>


    The body for this request would be:

    {"id":0,"params":["00:04:20:...",["power", 1]],"method":"slim.request"}

    Where you put the player's MAC address instead of 00:04:20....

    --

    Michael
    Hi Michael,

    thanks for the advice. I tried several options today but unfortunately could not get it to function. Therefore I will ask on another forum for help. Nevertheless I will reply in this tread if I find a solution.

  4. #4
    Senior Member
    Join Date
    Apr 2015
    Posts
    715
    You should elaborate, what exactly you already tried. :-)

    Works for me via my RasPi:
    1. Shortcuts
    2. "+"
    3. Scripts
    4. ... SSH ...
    5. credentials for SSHing into my RasPi
    6. script:
      Code:
      curl -X POST -d '{ "id": 1, "method": "slim.request", "params":["00:04:20:xx:xx:xx", ["power", 0]]}' 192.168.178.37:9000/jsonrpc.js

    Be sure that
    • you have the right and matching pairs of paranthesis.
    • the letters in the MAC-adress are all lower case

  5. #5
    Senior Member
    Join Date
    Apr 2015
    Posts
    715
    Got it now working straight from iPad to LMS:
    1. New Shortcut
    2. Choose "Web"
    3. From Web Requests choose "Get Contents of URL"
    4. Follow my picture story
      • URL has to start with http://
      • Headers are not necessary

    Attached Images Attached Images     

  6. #6
    Senior Member
    Join Date
    Apr 2015
    Posts
    715

    See also there


Tags for this Thread

Posting Permissions

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