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

Fibaro HCL and Denon HEOS


Henrik

Question

Hi forum members!

Please login or register to see this image.

/emoticons/default_icon_smile.gif" alt=":-)" />

I'm trying to integrate my Denon HEOS multi-room sound system into Fibaro. The goal is to be able to turn on music using scenes, for example to wake me up in the morning. Since I've a HCL I can only use virtual devices.

The Denon HEOS system can be controlled by connecting to port 1255 (Telnet or raw) and sending URI-like commands. The response is a JSON string.

I've tried sending commands using PuTTY and it works very well. However I cannot get it to work from HCL using a virtual device. So I thought that perhaps PuTTY sends the command in a different way? Using IO Ninja I started a TCP-listener on my computer and compared the way PuTTY and HCL sends the commands. I could conclude that they were identical!

By coincidence I happened to be connected to my HEOS system with PuTTY at the same time as I triggered the virtual device and it worked! In other words, if the port is already opened (in my case by PuTTY from my computer) the virtual device works, if not then it doesn't.

I'm confused, what could be the problem? Is it the way Fibaro HCL sets up the TCP-connection that differs? Any suggestions are very welcome!

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Link to comment
Share on other sites

Recommended Posts

  • 0

Cant offer any help, but i am very interested if you can make it work.
So please update this post, if you solve it

Please login or register to see this image.

/emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

[ Added: 2015-02-02, 19:15 ]
I found this PDF with the protocol... (now i just need some Heos hardware)

Please login or register to see this link.

  • Like 1
Link to comment
Share on other sites

  • 0
  • Inquirer
  • I sure will!

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

    That's the specification I've used.

    Hopefully someone who has experience in using virtual devices with telnet/raw connections can help out.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I would really appreciate if someone could help? Anyone? 

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> 

    Link to comment
    Share on other sites

    • 0

    I bought a cheap secondhand Heos 3. I have the same experience as you.

     

    As soon as I send one command from Putty, all commands work in HCL. As soon as I close Putty all commands stop working in HCL.

    I guess the work around is to have a device keep the line open for the HCL.

    Link to comment
    Share on other sites

    • 0

    "HEOS speaker spawns CLI core modules when the controller establishes the first socket connection to the speaker."

    I guess this is a part of the problem, the CLI core does not start on HCL commands.

    Link to comment
    Share on other sites

    • 0

    I used this code to connect to my reveiver over TCP on a specified port. Just alter the variables and give it a go

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    //a

    tcpSocket = Net.FTcpSocket("192.168.1.20", 50000);

    tcpSocket:setReadTimeout(5000);

    --fibaro:log(tcpSocket);

    fibaro:sleep(300);

    tcpSocket:write("@MAIN:PWR=On\r");

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Thanks rasmussen_a, but as far as I understand it is not possible to run LUA on the HCL.

     

    I think that the "sleep" you have in your code is important to get it to work correctly, unfortunately there is no way to do this in a virtual device.

    Link to comment
    Share on other sites

    • 0

    Ah sorry, did not read the HCL part (I blame my phone and the time of day

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> ).

    About to order some Heos devices so I will give it a try when it arrives and see what I can come up with. 

     

    //a

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Ah sorry, did not read the HCL part (I blame my phone and the time of day

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> ).

    About to order some Heos devices so I will give it a try when it arrives and see what I can come up with. 

     

    //a

     

    Please give us an update! 

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi rasmussen_a,

     

    Did you ever get it to work? 

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

     

    My walk-around at the moment is to keep an open TCP-connection from my NAS.

    Link to comment
    Share on other sites

    • 0

    Hey Henrik

     

    To be honest I have not had the time to try yet, the Heos Amp is till in its box awaiting better days. The main reson is that we are moving to another place as they a building up our new house. So at the moment all I have in my z-wave network are 2 items, door sensor and a motionsensor.... 

     

     

     

    //a

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I did some tests this weekend using some Java code. My findings:

    • If I only write to the output stream (to the Denon HEOS) nothing happens
    • If I write to the output stream AND read the result from the input stream (from the Denon HEOS) it works!

    I'm not sure what the box "wait for response..." in Fibaros virtual device does? Maybe it just waits for a HTTP-response?

     

    Anyway, I've created a "proxy"-servlet which I run in a Tomcat-server on my NAS and it works very well! 

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    Link to comment
    Share on other sites

    • 0

    It seems that the HEOS 3 communication is somewhat inconsistent. 

     

    I have it working using the code below, but...

    Note the WHILE loop. It's needed because when sending a command, I get incorrect pid error ("ID Not Valid") most of the time. It's somewhere around 15 error replies before the command is finally accepted. This results in a somewhat laggy communication. ~1-3sec after every key press.

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Rait,

     

    Since the last update (1.304.61) I've also noticed some strange behavior that is likely due to software bugs in the HEOS.

    • The HEOS player sometimes replies "ID Not Valid" to some commands, "play state" being among them.
    • The HEOS player sometimes responds "result: success" to "play state" changes even though it doesn't start to play or stop. I've seen others talk about this as well on other forums. The HEOS native-app stops functioning as well and the only way to solve this is a restart of the HEOS player.

     

    However, in my case it seams to be working a whole lot better if I always sign in first.

     

    So, can you try to add this to you code:

    1. Check if you're signed in with:

      Please login or register to see this code.

      The response should contain "signed_in&un=..." if you are. If so then you're good.
       

    2. If needed sign in with:

      Please login or register to see this code.

      The sign in command will first result in an "command under process" response while HEOS is trying to sign in and then finally a success response when signed in.

    Hopefully this will help you as well. Something else I noticed with my Servlet is that keeping the connection open (instead of establishing a connection each time) also enhance stability and performance. Waiting 1-3 seconds is far from user friendly!

    Link to comment
    Share on other sites

    • 0

    Hello! 

     

    I just got myself a HCL and wanted to integrated it with my Heos speakers. So, was wondering if there are any updates here?

     

    Realized that there is a heos plugin now, is that working flawless for you or it still needs some tweaking? I can see my HEOS devices but for some reason they don´t show up when building a scene. Might be some beginners mistake... 

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi MartinB,

     

    Unfortunately we cannot use plugins in scenes (at least not yet).

     

    When I first created the virtual device I was running v3 and I couldn't get it to work to call the HEOS system directly. I ended up building my own integration, a servlet which I run on a NAS which "talks to" the HEOS system. I then use virtual devices to make calls to the servlet. The servlet updates the virtual devices in its turn (labels with now playing).

     

    The plugin created by Fibaro needs to be updated with login information for the HEOS-account or it will never be usable. It sucks that you first have to add stuff to your playlist.

     

    Maybe v4 will work better, but the servlet-solution is working very well so I haven't tried it out yet.

    Link to comment
    Share on other sites

    • 0

    Hi Henrik, 

     

    ah, that´s unfortunate. But, if i want to use my HEOS as a wake up clock then i do need the ability to add it to a scene right? I´m running v4 on my HCL, all I can do is to start/stop music - which i rather do from the HEOS app. 

     

    Would that servlet be possible to run on my synology nas you think? I´d love to get a copy in that case. I´m no programmer myself, but it would be really cool to get it working! 

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I actually run it my Synology NAS (Intel Atom-based) using Java/Tomcat (available from package center).

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

     

    I wouldn't mind sharing it, but it needs som refactoring before I can share it. It's very customized for my own use at the moment. I'm not sure when I will get the time tough since I just became a father.

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

    Link to comment
    Share on other sites

    • 0

    Congratulations! That tends to remove some time from hobbies =) 

     

    Is it a big chunk of code? Maybe I could use the "raw" version as reference when trying to build something myself? I did enjoy the Java classes in university, only problem is that it was 15years ago.. 

    Link to comment
    Share on other sites

    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...