Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 8 of 8
  1. #1
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,604

    Where can I find the CLI documentation?

    On your LMS: http://localhost:9000/html/docs/cli-api.html (replace "localhost" with your server's address).

    Don't have LMS running? What are you doing here then, anyway? The documentation is on github, of course. Read it online. It's not nicely laid out, but hey, it's available!
    Michael

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

  2. #2
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    6,220
    Quote Originally Posted by mherger View Post
    On your LMS: http://localhost:9000/html/docs/cli-api.html (replace "localhost" with your server's address).

    Don't have LMS running? What are you doing here then, anyway? The documentation is on github, of course. Read it online. It's not nicely laid out, but hey, it's available!
    Is there similar documentation for the JSON interface somewhere?
    Jim
    https://jukeradio.double6.net


    VB2.4 storage QNAP TS419p (NFS)
    Living Room Joggler & Pi4/Khadas -> Onkyo TXNR686 -> Celestion F20s
    Office Joggler & Pi3 -> Denon RCD N8 -> Celestion F10s
    Dining Room SB Radio
    Bedroom (Bedside) Pi Zero+DAC ->ToppingTP21 ->AKG Headphones
    Bedroom (TV) & Bathroom SB Touch ->Denon AVR ->Mordaunt Short M10s + Kef ceiling speakers
    Guest Room Joggler > Topping Amp -> Wharfedale Modus Cubes

  3. #3
    Senior Member
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    833
    It's basically the same.
    You'll have to put the command JSON formatted to LMS-IP:9000/jsonrpc.js

    To set the volume to 25 (CLI: "04:20:00:12:23:45 mixer volume 25<LF>" )you could POST it like this:

    Code:
    curl -X POST -d '{ "method": "slim.request", "params":["00:04:20:xx:xx:xx", ["mixer", "volume", "25"]]}' 192.168.178.37:9000/jsonrpc.js
    The JSON part ist embraced by ' followed by {. The latter for handling it as a dictionary.
    The command itself is a list consisting of the player ID (MAC) and another list with the parameters p0 to p5.

    see also here for a good overview:
    https://gist.github.com/samtherussel...d2470b8689d9f2

  4. #4
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    6,220
    Quote Originally Posted by karlek View Post
    It's basically the same.
    You'll have to put the command JSON formatted to LMS-IP:9000/jsonrpc.js

    To set the volume to 25 (CLI: "04:20:00:12:23:45 mixer volume 25<LF>" )you could POST it like this:

    Code:
    curl -X POST -d '{ "method": "slim.request", "params":["00:04:20:xx:xx:xx", ["mixer", "volume", "25"]]}' 192.168.178.37:9000/jsonrpc.js
    The JSON part ist embraced by ' followed by {. The latter for handling it as a dictionary.
    The command itself is a list consisting of the player ID (MAC) and another list with the parameters p0 to p5.

    see also here for a good overview:
    https://gist.github.com/samtherussel...d2470b8689d9f2
    Thanks
    Jim
    https://jukeradio.double6.net


    VB2.4 storage QNAP TS419p (NFS)
    Living Room Joggler & Pi4/Khadas -> Onkyo TXNR686 -> Celestion F20s
    Office Joggler & Pi3 -> Denon RCD N8 -> Celestion F10s
    Dining Room SB Radio
    Bedroom (Bedside) Pi Zero+DAC ->ToppingTP21 ->AKG Headphones
    Bedroom (TV) & Bathroom SB Touch ->Denon AVR ->Mordaunt Short M10s + Kef ceiling speakers
    Guest Room Joggler > Topping Amp -> Wharfedale Modus Cubes

  5. #5

    a general command to jsonrpc.js

    Thanks all for sharing! This really helped me get started. I was having some trouble figuring out how to send some other commands though until I saw somewhere that if you want to send a "general" command for example you still need to give a mac address for some reason? So I got this to work for example. Not sure also if/why the "id":0 is needed but I put that in there too

    Code:
    {
        "method": "slim.request",
        "params": [
            "FF:FF:FF:FF",
            [
                "player",
                "count",
                "?"
            ]
        ],
        "id": 0
    }
    Question, does anyone know how to interact with apps? Such as spotify or pandora? I got the list to work:

    Code:
    {
        "method": "slim.request",
        "params": [
            "FF:FF:FF:FF",
            [
                "apps",
                "0",
                "15"
            ]
        ],
        "id": 0
    }
    And I get something like this:

    Code:
    {
        "method": "slim.request",
        "id": 0,
        "result": {
            "count": 13,
            "appss_loop": [
                {
                    "type": "xmlbrowser",
                    "icon": "plugins/Spotty/html/images/93aac68fb06348598c1e67734dfaceee.png",
                    "weight": 1,
                    "cmd": "spotty",
                    "name": "Spotty"
                },
                {
                    "icon": "plugins/Pandora/html/images/icon.png",
                    "type": "xmlbrowser",
                    "weight": 10,
                    "cmd": "pandora",
                    "name": "Pandora"
                },
    ...

  6. #6
    I think I found it here:

    https://forums.slimdevices.com/showt...2985-JSON-help

    I just got this to work (have to talk to one specific player...)

    Code:
    {
        "method": "slim.request",
        "params": [
            "aa:bb:eb:zz:yy:xx",
            [
            	"myapps",
            	"items",
            	"0",
            	"9"
            ]
        ],
        "id": 0
    }
    Then, you get an item id in the response and use it like this to go down that path:

    Code:
    {
        "method": "slim.request",
        "params": [
            "aa:bb:eb:zz:yy:xx",
            [
            	"myapps",
            	"items",
            	"0",
            	"9",
            	"item_id:xyz859.0"
            ]
        ],
        "id": 0
    }

  7. #7
    Senior Member philchillbill's Avatar
    Join Date
    Jan 2019
    Location
    The Netherlands
    Posts
    821
    Am I correct in concluding that there is not much of an error handler for the jsonrpc interface? If, for example, I request the status of a player but provide an incorrect playerid, instead of a nice JSON response error string along the lines of 'unknown playerid' or 'player offline', all I get is a http disconnect. If accessing LMS via ngrok then it's a 502 Proxy Error I see with "The proxy server received an invalid response from an upstream server". Any way to get 'nicer' error responses from jsonrpc.js ?

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

    Where can I find the CLI documentation?

    > Am I correct in concluding that there is not much of an error handler
    > for the jsonrpc interface? If, for example, I request the *status* of a


    I think that's correct, yes.

Posting Permissions

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