Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 3 123 LastLast
Results 1 to 10 of 24
  1. #1

    way to detect Picoreplayer connected to LMS

    Hello everybody.
    I think about add a feature to Picoreplayer and raspberry.
    sometimes when I turn on my zero w to connect picoreplayer to Logitech media server , I always don't have Hdmi output to understand what status it is in,
    recently I wrote a sh script to turn on led when it is connected to wifi with bash scripting gpio.

    I want to ask you a solution ,
    is there a way or parameter i can check when it is connected to LMS server?
    for example after connecting a variable or flag is set and I can check it in loop.
    the wifi led method I used is good but as I said connecting to lms server or for example finding out this zero w is detected by server and synced and after that turn the led on is more reliable.

  2. #2
    Senior Member Greg Erskine's Avatar
    Join Date
    Sep 2006
    Location
    Sydney, Australia
    Posts
    1,579
    hi nimaazx,

    I am not 100% sure what you are after.

    From my experience if LMS is up, then squeezelite *always* connects, well 99.99% of the time.

    The command netstat shows you the connection between squeezelite and LMS.

    Code:
    tc@piCorePlayerSCREEN:~$ netstat -t
    Active Internet connections (w/o servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State
    tcp        0      0 192.168.1.15:48962      192.168.1.6:3483        ESTABLISHED
    tcp        0    160 192.168.1.15:ssh        192.168.1.16:54966      ESTABLISHED
    tcp        0      0 192.168.1.15:46816      192.168.1.6:9000        ESTABLISHED
    netstat: /proc/net/tcp6: No such file or directory
    tc@piCorePlayerSCREEN:~$
    regards
    Greg

  3. #3
    ]
    Quote Originally Posted by Greg Erskine View Post
    hi nimaazx,

    I am not 100% sure what you are after.

    From my experience if LMS is up, then squeezelite *always* connects, well 99.99% of the time.

    The command netstat shows you the connection between squeezelite and LMS.

    Code:
    tc@piCorePlayerSCREEN:~$ netstat -t
    Active Internet connections (w/o servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State
    tcp        0      0 192.168.1.15:48962      192.168.1.6:3483        ESTABLISHED
    tcp        0    160 192.168.1.15:ssh        192.168.1.16:54966      ESTABLISHED
    tcp        0      0 192.168.1.15:46816      192.168.1.6:9000        ESTABLISHED
    netstat: /proc/net/tcp6: No such file or directory
    tc@piCorePlayerSCREEN:~$
    regards
    Greg
    ok greg, thank you very much.
    I describe what I want to run.
    I have many zero w work with windows lms server.
    yesterday I tested 4 synced zero w.
    at first I took #1 to master in settings.
    after that I disconnected each other during playing music to find out what is the action of the others about syncing. Everythings looked good.
    but at first when I brought back #2 zero w again during playing, it was not detected in lms and list.I restarted many times. not shown in lms.
    I went to setting menu and change a setting something like this of each player:
    "pause at power off, resume at power on"

    i dont know it is related or not but after doing this when each other brought back and turned on worked good.

    as i described my idea, I wanted to sure when each on is connected to lms when they turned off and turned on again, after that my led connected to gpio is going to be on to show zero w connected to server.
    (with sh bash scripting)
    I did it and turned on my led with by just checking wifi connection not checking zero w connected to lms server. I'm finding a way for this.

    maybe netstat is similar to ping command , good idea , I can check it by pinging lms ip address from zero w. but it needs to define static ip address for our logitech media server in network.
    main question is , is pinging trusty for my goal?
    I mean when it can ping lms server,
    lms server can show the player name and detected in its player list?
    maybe pinging is not related to detection process.
    I searched in squeezelite command line or parameters for a flag or Special characteristic is set when it connects to lms server.

  4. #4
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    16,852
    You may need to start looking at using CLI and possibly JSON - it can ge complicated.

    Look at this thread for ideas. https://forums.slimdevices.com/showt...active-players

    Possible command are in the LMS technical information (webGUI Help / Technical Information / The Logitech Meda Server Command line interface or http://htmlpreview.github.io/?https:...s/cli-api.html )
    Last edited by bpa; 2019-02-01 at 02:26.

  5. #5
    Quote Originally Posted by bpa View Post
    You may need to start looking at using CLI and possibly JSON - it can ge complicated.

    Look at this thread for ideas. https://forums.slimdevices.com/showt...active-players

    Possible command are in the LMS technical information (webGUI Help / Technical Information / The Logitech Meda Server Command line interface or http://htmlpreview.github.io/?https:...s/cli-api.html )

    thank you but I think it is for server side. for example this command for using to detect players state.

    <playerid> connected ?

    Returns the connected state of the player, 1 or 0 depending on the state of the TCP connection to the player. SLIMP3 players, since they use UDP, always return 1.

    Examples:

    Request: "04:20:00:12:23:45 connected ?<LF>"
    Response: "04:20:00:12:23:45 connected 1<LF>"

    i need something else, vice versa...
    detecting server status from client side (zero w)
    or detecting my zero w is connected to server.
    if connected led is going to be on.
    disconncted or lms server not found/led off.

  6. #6
    Senior Member
    Join Date
    Sep 2005
    Posts
    2,810
    hi,

    Quote Originally Posted by nimaazx View Post
    ]
    maybe netstat is similar to ping command , good idea , I can check it by pinging lms ip address from zero w. but it needs to define static ip address for our logitech media server in network.
    main question is , is pinging trusty for my goal?
    no ping is nothing other than icmp works that doesnt help nobody
    A Server wihout a static ip is .... not a server
    Code:
    netstat -a|grep 3483|rev|cut -d ':' -f2-|cut -d ' ' -f1|rev
    Quote Originally Posted by nimaazx View Post
    thank you but I think it is for server side. for example this command for using to detect players state.

    <playerid> connected ?

    Returns the connected state of the player, 1 or 0 depending on the state of the TCP connection to the player. SLIMP3 players, since they use UDP, always return 1.
    ???????
    slimp3 <> picoreplayer
    WHAT is your goal?

  7. #7
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    16,852
    Quote Originally Posted by nimaazx View Post
    thank you but I think it is for server side. for example this command for using to detect players state.

    <playerid> connected ?

    Returns the connected state of the player, 1 or 0 depending on the state of the TCP connection to the player. SLIMP3 players, since they use UDP, always return 1.

    Examples:

    Request: "04:20:00:12:23:45 connected ?<LF>"
    Response: "04:20:00:12:23:45 connected 1<LF>"

    i need something else, vice versa...
    detecting server status from client side (zero w)
    or detecting my zero w is connected to server.
    if connected led is going to be on.
    disconncted or lms server not found/led off.
    The CLI command will be sent to the LMS server by the pie Zero w. This means there is a network connection between player Pi and LMS server Pi. The reponse to the command "connected" tells you the LMS Server can "see" the player and the TCP connection on port 3483 is OK and working. If player is not connected to LMS as seen by LMS then connected state will be zero - you can only get this result from a Pi zero W when the TCP connection to server Pi is OK - so you can be sure the network connection is OK but the player connection on port 3483 is not OK. You can use the "players" command to get a list of all known players and their connected status (i.e. whether a TCP port 3483 connection is active).

    The ability to make a telnet connection to CLI port on LMS - means the LMS server is OK - what more do you need ?
    Last edited by bpa; 2019-02-01 at 13:30.

  8. #8
    Quote Originally Posted by DJanGo View Post
    hi,



    no ping is nothing other than icmp works that doesnt help nobody
    A Server wihout a static ip is .... not a server
    Code:
    netstat -a|grep 3483|rev|cut -d ':' -f2-|cut -d ' ' -f1|rev

    ???????
    slimp3 <> picoreplayer
    WHAT is your goal?
    I have not been much familiar with linux bash command.I must search before use them. I have to test this command tomorrow.
    but about slimp3 , that commands are on logitech media server document page. I think the client is not the matter what it is. Overall, I doubted how and where to use these commands.
    what commands in server side on my windows lms / or what commands must be written in zero w client sh bash.

  9. #9
    Quote Originally Posted by bpa View Post
    The CLI command will be sent to the LMS server by the pie Zero w. This means there is a network connection between player Pi and LMS server Pi. The reponse to the command "connected" tells you the LMS Server can "see" the player and the TCP connection on port 3483 is OK and working. If player is not connected to LMS as seen by LMS then connected state will be zero - you can only get this result from a Pi zero W when the TCP connection to server Pi is OK - so you can be sure the network connection is OK but the player connection on port 3483 is not OK. You can use the "players" command to get a list of all known players and their connected status (i.e. whether a TCP port 3483 connection is active).

    The ability to make a telnet connection to CLI port on LMS - means the LMS server is OK - what more do you need ?

    Ok, thank you very much.
    I understood what you said. I'm really interested in details.
    if I understand correclty , you tell that command can be run on zero w with sh scripting language.
    i'm too confused about commands in a document page.

    in easy solution i can just check wifi connection and turn on led. but as I tell you and you know that is maybe not reliable.

    if you know , please tell me what commands are in a client side and what commands are in lms side.
    how much I read documents i'm more confused.

    as well as the telnet method you said is related to "<playerid>" command or is a separate method?

    if i understand from you and another person in this topic said, we can just check tcp port "3483". it is used for connecting to lms. when it is connected , We are sure 100% it is known by lms server.

    I'm really sorry about my english. it is not my native language.

  10. #10
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    16,852
    Quote Originally Posted by nimaazx View Post
    if i understand from you and another person in this topic said, we can just check tcp port "3483". it is used for connecting to lms. when it is connected , We are sure 100% it is known by lms server.
    The following mnay be too much for you but you might as well have the info.

    Player discover LMS servers using broadcast on UDP on port 383 - iognore this if you see references to this.

    LMS talks to a player(e.g. squeezelite) using a protocol called slimproto on a TCP connection on port 3483 of the LMS server. Slimproto enables player to be told by LMS player to play music from an URL (can be remote but usually LMS) , vol up , vol down etc. Using slimproto Player tell LMS when it needs data, buffer empty etc.

    To talk to an LMS server a player has to open a TCP connecton from the player to the LMS server on port 3483. This means if a player is actively connected to an LMS server there is a TCP connection on the player to destination port 3483.

    The CLI is a totally separate LMS communication. It is supported by LMS server usually on port 9090 (can be changed in settings). It is intended to be used by "remote" applications (i.e. not running on LMS server processor) who want to "talk" to LMS server and get info from the LMS server about the LMS system, libraries etc.

    I don't know what available on pcp. but if LMS is on a server with IP address 192.168.1.250 then this would be (LMS inserts <LF> betweens lines of the response which is encoded as %3A). BLue is the user entry, red is LMS response - use your own IP address and MAC address of player has been altered.
    Code:
    telnet 192.168.1.250 9090
    Trying 192.168.1.250...
    Connected to 192.168.1.250.
    Escape character is '^]'
    players
    players   count%3A2
    players 0 1 connected
    players 0 1 connected count%3A2 playerindex%3A0 playerid%3A7x%3Adx%3A3x%3Aax%3A3x%3A7x uuid%3A ip%3A192.168.1.58%3A32806 name%3ASqueezeLite seq_no%3A0 model%3Asqueezelite modelname%3ASqueezeLite power%3A1 isplaying%3A0 displaytype%3Anone isplayer%3A1 canpoweroff%3A1 connected%3A1 firmware%3Av1.8-589
    7x:dx:3x:ax:3x:7x connected ?
    7x%3Adx%3A3x%3Aax%3A3x%3A7x connected 1
    I don't know what is available on pcp but once you understand the CLI commands then for an application you might find it easier to use "curl" on port 9000 and using POST request JSON encoded commands instead of telnet - the CLI command is in the "params"
    example command
    Code:
    curl -X POST -d '{"id":0,"params":["00:04:20:ab:cd:ef",["playlist","index","+1"]],"method":"slim.request"}' http://yourserver:9000/jsonrpc.js

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
  •