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


Question

Posted

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.

Recommended Posts

  • 0
  • Inquirer
  • Posted

    Thanks!

    Please login or register to see this image.

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

     

    I have it as an Eclipse Servlet-project. I could export it for you if you want to (even though it is customized for my setup).

     

    What you would have to then is to:

    • Import the project into Eclipse
    • Change constants (player IPs, player IDs, station IDs, HCL IP and some other stuff)
    • Build and export the project as a war file
    • Deploy the war file in Tomcat
    • Setup the virtual devices for HEOS players in the HCL Web GUI
    • Try it out!

    Tell me if you're up for it.

    Please login or register to see this image.

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

    • 0
    Posted

    Hi, 

     

    oh yes, I´m up for it! How hard can it be  

    Please login or register to see this image.

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

     

    So, the virtual devices on HCL, they communicate with the servlet via the string that you enter. But what format is it of? 

     

    I´ll do my best not to harass you with to many questions 

    Please login or register to see this image.

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

    • 0
    Posted

    Hm, so i can control my HEOS speakers over telnet. But, when adding the same commands as string in virtual device in HCL it doesn´t work. Not even when i am logged in to heos via putty. 

     

    I notice in your screenshots Henrik that you have som 0x0Dx.. at the end of the commands in HCL. What is that about? 

    • 0
  • Inquirer
  • Posted

    MartinB: I could never get it to work directly from a virtual device, that's partly why I built the servlet. I've started to clean up the code, but I never seam to have the time to finish it.

     

    I'm not sure why 0x0D0x0A0x0D0x0A is needed, but it has been proposed several times in the forum (by Fibaro as well).

    • 0
    Posted

    Ah, ok. But for you it worked at least when logged in to HEOS via putty at the same time right? Annoying...

     

    You don´t have to clean all up for me. I'm sure I´ll get it after a while 

    Please login or register to see this image.

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

    • 0
    Posted

    So, I have Henriks servlet running at home since a few months and it works just fine! 

     

    Still I would like to get it to work directly from Fibaro though without having to rout it via the NAS. I tried it out a bit more the other day and..

    -I can create a virtual device that plays/pause what was played last on the heos. That seem to work fine. But when i try to play some tune-in favourite (basically not just pressing play on whatever was played last time) it doesn´t seem to work (same command works from putty though). Was that kind of where you left off as well Henrik? 

    -I have a virtual device connected to the plugin and that works as well. However, the plugin only supports play/pause/volume so it isn´t more fun than the above. 

     

    Has anyone had more progress than me? 

     

    /Martin

    • 0
    Posted

    Hm, now it seem to work all of a sudden. I have a virtual device talking directly to Heos where i can play favourites etc. For some reason it didn´t work when I connected the VD to the IP of one of the heos speakers but started working when i changed to another speaker IP. 

     

    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" />

    • 0
  • Inquirer
  • Posted

    Hm, now it seem to work all of a sudden. I have a virtual device talking directly to Heos where i can play favourites etc. For some reason it didn´t work when I connected the VD to the IP of one of the heos speakers but started working when i changed to another speaker IP. 

     

    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" />

     

    That's great news!

     

    Which version are you running?

     

    How does your Virtual Device look like?

    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" />

    • 0
    Posted

    Hi, 

     

    i´m running 4.08

     

    But, I might have been fooling myself a bit here.. Just realized that I haven´t shut down Tomcat on the NAS so maybe the servlet was keeping some connection open for me? 

     

    Shut it down a while ago now, and, "play/pause" works fine, "starting a favourite" worked on one of the speakers but not the other (so weird). Will set an alarm and see if i wake up tomorrow or not..

    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" />

     

    I haven´t done anything special in the VD at all (attaching). 

    Please login or register to see this attachment.

    • 0
    Posted

    Well, it did start playing this morning =) 

     

    Will have some scenes running for a while now to see if it´s stable. 

    • 0
  • Inquirer
  • Posted

    MartinB, is it still working 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" />

     

    I'm actually surprised that it works, because according to the CLI specification the "Play Station" uses sources like TuneIn, Deezer, Tidal, Rdio, SoundCloud and they all require that you sign in first, e.g. run the command: heos://system/sign_in?un=heos_username&pw=heos_password

     

    Another thing is that if you read the design guidelines, Denon states: 

     

     

    If controller design involves disconnect and reconnect to HEOS speakers through CLI, it is recommended to keep a idle connection to HEOS Speaker thus avoiding CLI module to set back to dormant mode.

     

    This is the reason why I chose to implement a Servlet which is always connected to the Denon HEOS. I even send heartbeat-commands to make sure the connection stays alive. I don't know how many speakers you use, but I've noticed that when you connect for the first time it takes som time for the HEOS system to detect all speakers. Again from the design guidelines:

     

     

    Inability of CLI module to process player commands. This is because, by nature of UPnP, CLI module need some time to discover all players before they can be identified by their unique Id (pid)

     

    It would be great to be able to skip the Servlet (even if it has some smart functionality like automatically ungrouping speakers), please report your progress.

    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" />

    • 0
    Posted

    Hi, 

     

    well, it did.. for three days. Only problem was that music was delayed with 5-10min (i have one scene scheduled to start playing 06.30 but it actually started around 06.38 instead, every time). Today though nothing was started at all. When i checked with putty I saw that I had been signed out, which probably explains it. Do you know how long time of inactivity is needed to trigger a sign-out?

     

    So, I´m thinking i could schedule nightly sign-in and also continous heartbeat commands (maybe once per hour). You think it would work? 

    • 0
  • Inquirer
  • Posted

    I think it's absolutely worth a try!

    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" />

     

    Maybe you can send the sign-in command every n:th hour and see if it helps?

    • 0
    Posted

    Hi again, 

     

    I´ve had it up and running since saturday now and it still works! Starts and stops two different scenes every morning. So far so good

    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" /> 

     

     

    I´ve added a sign-in every morning and a heartbeat message every hour. Not sure if there are any negative side effects of that. Perhaps i´m blocking the speakers so they can´t go to sleep which increases power consumption?

    • Like 1
    • 0
  • Inquirer
  • Posted

    That's great news!

    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" />

    • 0
    Posted

    Hi MartinB and Henrik. I have 2 x Heos Drives and Fibaro HC2. I want to control the Heos with a Fibaro scene - select a zone, select favourite to play, then play. I need help please. MartinB, would you mind sharing your code with me please? Henrik I am trying to get your servlet going, but am running into errors in the HEOSServlet in Eclipse. I attach a screenshot. Apologies I am not very familiar with Eclipse. Any advice will be appreciated.

    Please login or register to see this attachment.

    • 0
  • Inquirer
  • Posted (edited)

    @Edgarl It could be that you're missing the libraries needed, my guess is that the Tomcat libraries cannot be found.

     

    Have you downloaded Tomcat libraries and included them in the Eclipse project?

    Edited by Henrik
    • 0
    Posted

    @Henrik I managed to get your servlet going inside Eclipse. Turned out I had Tomcat v8 and Java v8 while Tomcat v8 supports up to Java v7 only. I installed Tomcat v9 and that did the trick. I attach a picture showing the servlet display showing my ip address and Heos device ids and so on. I then created a virtual device with ip being the ip of the machine running Tomcat (inside Eclipse) and programmed one button to start play on one of the Heos devices. I attach screen grabs of these. But when I press that VD button I get an error message as follows (screen grab also attached):

     

    INFO: Error parsing HTTP request header
     Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
    java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens

     

    Please help if you can.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    @Henrik Apologies, please ignore previous post. Figured it out. I obviously had to use the VD you supplied. Did that and can now get a Heos device playing. yay!

    • 0
  • Inquirer
  • Posted

    @Edgarl I think that it should be http and not https. Can you try to change to http in your virtual device? Eg. http://192.168.0.83:8080/heos?player=1771686516&command=play

    • 0
    Posted

    @Henrik, sorry I figured it out after I posted the previous post. Now have it working in a device and in a scene. So looking good. Still have my Tomcat server running within Eclipse. When I uploaded my exported project WAR file into a Tomcat server started from the Windows command line, it didn't work. So got to figure that out still. Like you, I also have Synology NAS so am going to try to get the servlet running on there also. Thanks for the help. And lots of thanks for servlet code.

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