Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Controlling Linn Sneaky from HC2


Question

Posted

Hi

I have a Linn Sneaky network player that is controllable via a TCP/IP point-2-point protocol. I want to make a virtual device to control basic functions like volume from my HC2 

 

One "volume command" is: Action Ds/Volume 1 VolumeInc, but I cannot figure how to get it sent to the network player using either the string method og LUA. The correct thing is as I understand to send the command in "plain text" to my network player.

 

Can someone please point me to a thread where I can reuse the method or please tell me how to proceed? (Last time I programmed was 20 years ago, but if I get an example or something similar it´s a good start).

 

 

Control protocol:          

Please login or register to see this link.

Commanc examples:   

Please login or register to see this link.

8 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • Posted

    Ok, one step further. I can control my network player by opening a telnet session on my computer and send the commands from the text prompt. So what I really want is to send plain text to the IP-adress of my network player(which is listening) through TCP/IP. I have tried several methods found at this forum but with no luck:

     

    Method 1:

    tcpSocket = Net.FTcpSocket("192.168.1.163", 23) 

    bytes, errorCode = tcpSocket:write("Action Ds/Volume 1 VolumeDec") 
    fibaro:debug(errorCode) 
    if errorCode == 0 
      then 
      fibaro:debug("Done")
    else 
      fibaro:debug("Error") 
    end
     
    Method 2:
    local bytes, errorCode = socket:write("Action Ds/Volume 1 VolumeInc", "192.168.1.163", 80);
    --check for error     
    if errorCode == 0 then
      fibaro:debug("ok");
      -- Process bytes response...
    else
      fibaro:debug("error");
    end
     
    Since my programming skills for now is initial I´m not able to reveal whats wrong with the code.  So, please advice.
    • 0
    Posted

    I can tell one thing: method 1 only works in a Virtual Device, not in a Scene. So you make a new VD, add a button and copy/paste method 1 in a button. Hope this gets you started...

    • 0
  • Inquirer
  • Posted

    Hi

    Thanks for your reply. I´ve only been using Virtual Devices and the "method 1" does not alter the volume setting. However if I open a Telnet shell the same command do. 

    • 0
    Posted

    OK, that's good to know. I'm sorry, I don't have such a device, or a device that communicates like that. Here's two idea's that I have. First, what happens if you repeat the line with "tcpSocket:write", so as to send the command twice? Second I saw that the documentation lists the commands in capitals. But I suppose you have thought of that. Hmm. When you copy/paste the string from you HC2 into telnet that's OK?

    • 0
    Posted

    Maybe the command needs a terminator, like CR/LF? The doc doesn't say so, but... Could you maybe try

    this:

    Please login or register to see this code.

    • 0
  • Inquirer
  • Posted

    Hi

    I tried the telnet method once mote, and yes, I had to sent the command twice the first time in every new session. Your code with the CR/LR did the job, so my player is now responding! Thank you very much!

    • 0
    Posted

    You're welcome! BTW CR/LF can be added to the string in lua as "\r\n" - but I wanted to separate the ending from the command string, so I used char(). In hindsight, I could have written that as "Action Ds/Volume 1 VolumeDec".."\r\n". Or "Action Ds/Volume 1 VolumeDec\r\n". I hope you can now get the other commands to work!

    • 0
  • Inquirer
  • Posted

    Hi again!

    The method above makes me able to send commands to my Linn media player, however playing around with this, the interface stops working after a while. I see in the documentation that my mediaplayer accepts 4  "raw socket sessions" , addtional above are ignored. I sucpect that this might be the case. 

     

    I guess that I have to terminate the session/socket(?) for every command string I send to avoid build-up of sessions? Which command should I use for doing so? Please advise.

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...