Denon / Marantz 2.0 Binding

Just to let you know a new 2.0 binding is in the works for Denon / Marantz AVRs.
Almost finished development work, hopefully it can be included in the OpenHAB 2.3.0 release.

In the meantime you can download the jar file and place it into your addons directory.

See https://github.com/openhab/openhab2-addons/issues/2204 for more details.

Please let me know any feedback so I can try to incorporate it into the binding.

5 Likes

Hi JW,

First of all, thank you for “upgrading” the Denon binding to OH 2.0.
I had a Denon AVR-X2200W integrated with OH using the old Denon binding.
This worked pretty reliable. However, this AVR does not have Heos. So I’ve replaced it with a Denon AVR-X1400H. I used this opportunity to replace the old binding with the new one.

I installed the binding from the marketplace. Discovery went well, setting items was done quickly. I am able to turn on/off the receiver. All works well!

Except, Artist/Album/Track information doesn’t seem to be supported. It’s not that important to me (I had those items set up with the previous binding - but never really did anything with it). I’m not sure if these three channels are unsupported due to the new binding, or if it is something related to my new receiver. I’m pretty sure it worked with the old binding (combined with the Denon AVR-X2200W).

2018-01-07 16:26:29.906 [WARN ] [nmarantz.handler.DenonMarantzHandler] - Command for channel artist not supported.
2018-01-07 16:26:29.907 [WARN ] [nmarantz.handler.DenonMarantzHandler] - Command for channel album not supported.
2018-01-07 16:26:29.914 [WARN ] [nmarantz.handler.DenonMarantzHandler] - Unsupported command REFRESH for channel command
2018-01-07 16:26:29.913 [WARN ] [nmarantz.handler.DenonMarantzHandler] - Command for channel track not supported.

But again, this is not that essential to me. Power/Volume/Mute works fine, and this is what I use on a regular basis. Next step: configure the Heos binding to allow OH to trigger a specific online radio station.

In a few months, I’ll be setting up my previous Denon Receiver in another room. I’ll share my experiences in this topic.

Thank you for this binding!

Dries

P.S. For other OH users wanting to try out this new binding: check out this documentation. Installation can be done via the marketplace.

1 Like

I’m giving this binding a shot. I put the .jar file in my addons directory and it loads just fine. But for some reason I can’t get the Thing to get past INITIALIZING. Is there something I have to do or something I’m missing? I have a Denon AVR-X2400H with updated firmware and the following Thing definition:

Thing denonmarantz:avr:0005cdf03cf6 "Denon AV Receiver" [host="192.168.1.52", telnetEnabled = true]

Hi,
Have you tried the discovery function and let PaperUI create the Thing for you? That worked for me. If you try that (and it works), then you know at least the binding is functional, and it has more to do with how you manually create the Thing.

I can’t remember if I had to do it, but restarting OH might also help.

Worked for me! Great stuff!

Thanks @Dries for your feedback and guiding other users!

I believe Artist/Track/Album is supported (have seen it working with my own AVR). The warnings you see is that it does not support realtime refresh of the items. It will be polled/pushed as soon as there is an update of the track playing.
I might remove that warning in a next update.

Could you test whether it is updating the info as soon as you are playing a track?

@mladams922 can you enable DEBUG for the binding and share relevant output? Not sure what is going wrong here. And indeed, try to Discover it.

I’ll play with restarting OH but I did run the discovery and it came up, I could create the Thing via paper UI just fine but the Thing state just sticks as INITIALIZING whether it’s discovered or manually created. I’ll enable DEBUG support tonight and get those logs for you so we can see where it might be hung up. It might be something I haven’t configured yet. I did set it up to use telnet since it’s the newest series and the HTTP kept throwing errors but other than that I haven’t configured anything else. So I’ll get the error log and send that over to you.

Hi,
I just checked, and Artist/Track/Album remain empty.

These are the items:

String Denon_EV_Fitnessruimte_CurrentTrack "Denon Fitness Current track [%s]" <text> (gEV_Fitnesssruimte, gDenonAVR) {channel="denonmarantz:avr:0005cde98caa:track"}
String Denon_EV_Fitnessruimte_CurrentArtist "Denon Fitness Current artist [%s]" <text> (gEV_Fitnesssruimte, gDenonAVR) {channel="denonmarantz:avr:0005cde98caa:artist"}
String Denon_EV_Fitnessruimte_CurrentAlbum "Denon Fitness Current album [%s]" <text> (gEV_Fitnesssruimte, gDenonAVR) {channel="denonmarantz:avr:0005cde98caa:album"}

Regardless if a play online radio, Spotify, or an MP3 file on my phone: they are not being populated.

I also have the Heos binding installed. And in that binding, these values are being populated correctly. These are my Heos items:

String Heos_EV_FitnessruimtePlayer_CurrentTrack	"Denon Fitness Current track [%s]" <text> (gEV_Fitnesssruimte, gDenonAVR) {channel="heos:player:872704895:Title"}
String Heos_EV_FitnessruimtePlayer_CurrentArtist "Denon Fitness Current artist [%s]" <text> (gEV_Fitnesssruimte, gDenonAVR) {channel="heos:player:872704895:Interpret"}
String Heos_EV_FitnessruimtePlayer_CurrentAlbum	"Denon Fitness Current album [%s]" <text> (gEV_Fitnesssruimte, gDenonAVR) {channel="heos:player:872704895:Album"}

So I’m trying to get the DEBUG messages but I’m not making progress. What is the ID of the binding (org.openhab.binding.?) If I know that I’ll set it to debug and get some information out of it to send to you. It doesn’t seem to matter if I discover it or if I manually add it, either way it sticks at INITIALIZING.

It’s org.openhab.binding.denonmarantz

So this is the log I get:

15:26:31.554 [DEBUG] [org.openhab.binding.denonmarantz     ] - ServiceEvent UNREGISTERING - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={component.name=binding.denonmarantz, component.id=244, service.id=376, service.bundleid=246, service.scope=bundle} - org.openhab.binding.denonmarantz
15:26:31.560 [DEBUG] [org.openhab.binding.denonmarantz     ] - ServiceEvent UNREGISTERING - {org.eclipse.smarthome.io.transport.mdns.discovery.MDNSDiscoveryParticipant}={component.name=discovery.denonmarantz, component.id=245, service.id=377, service.bundleid=246, service.scope=bundle} - org.openhab.binding.denonmarantz
15:26:31.563 [DEBUG] [org.openhab.binding.denonmarantz     ] - BundleEvent STOPPING - org.openhab.binding.denonmarantz
15:26:31.564 [DEBUG] [org.openhab.binding.denonmarantz     ] - BundleEvent STOPPED - org.openhab.binding.denonmarantz
15:26:31.565 [DEBUG] [org.openhab.binding.denonmarantz     ] - BundleEvent STARTING - org.openhab.binding.denonmarantz
15:26:31.580 [DEBUG] [org.openhab.binding.denonmarantz     ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={component.name=binding.denonmarantz, component.id=246, service.id=378, service.bundleid=246, service.scope=bundle} - org.openhab.binding.denonmarantz
15:26:31.583 [DEBUG] [arantz.internal.DenonMarantzConnector] - disposing connector
15:26:31.584 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Disconnecting socket
15:26:31.586 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Error in telnet connection
java.net.SocketException: Socket closed
        at java.net.SocketInputStream.read(SocketInputStream.java:204) [?:?]
        at java.net.SocketInputStream.read(SocketInputStream.java:141) [?:?]
        at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284) [?:?]
        at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326) [?:?]
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) [?:?]
        at java.io.InputStreamReader.read(InputStreamReader.java:184) [?:?]
        at java.io.BufferedReader.fill(BufferedReader.java:161) [?:?]
        at java.io.BufferedReader.readLine(BufferedReader.java:324) [?:?]
        at java.io.BufferedReader.readLine(BufferedReader.java:389) [?:?]
        at org.openhab.binding.denonmarantz.internal.telnet.DenonMarantzTelnetClient.run(DenonMarantzTelnetClient.java:67) [246:org.openhab.binding.denonmarantz:2.3.0.201801011232]
15:26:31.586 [DEBUG] [arantz.internal.DenonMarantzConnector] - disposing connector
15:26:31.586 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:31.595 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:31.595 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Denon listener created
15:26:31.600 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Connecting to 192.168.1.52
15:26:31.600 [DEBUG] [onmarantz.handler.DenonMarantzHandler] - Adding zone channels
15:26:31.605 [DEBUG] [very.DenonMarantzDiscoveryParticipant] - AVR found: 0005CDF03CF6@Denon AVR-X2400H._raop._tcp.local.
15:26:31.606 [DEBUG] [very.DenonMarantzDiscoveryParticipant] - This seems like a supported Denon/Marantz AVR!
15:26:31.607 [DEBUG] [very.DenonMarantzDiscoveryParticipant] - Could not determine IP address for the Denon/Marantz AVR
15:26:31.608 [DEBUG] [org.openhab.binding.denonmarantz     ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.io.transport.mdns.discovery.MDNSDiscoveryParticipant}={component.name=discovery.denonmarantz, component.id=247, service.id=379, service.bundleid=246, service.scope=bundle} - org.openhab.binding.denonmarantz
15:26:31.611 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Denon telnet client connected to 192.168.1.52
15:26:31.612 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Sending command PW?
15:26:31.615 [DEBUG] [org.openhab.binding.denonmarantz     ] - BundleEvent STARTED - org.openhab.binding.denonmarantz
15:26:31.889 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:31.896 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:31.913 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Sending command MS?
15:26:32.191 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:32.197 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:32.214 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Sending command MV?
15:26:32.492 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:32.498 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:32.514 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Sending command ZM?
15:26:32.793 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:32.799 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:32.815 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Sending command MU?
15:26:33.094 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:33.100 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:33.116 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Sending command SI?
15:26:33.396 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:33.402 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:33.417 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Sending command Z2?
15:26:33.697 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:33.703 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:33.718 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Sending command Z2MU?
15:26:33.999 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:34.004 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:34.019 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Sending command Z3
15:26:34.300 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:34.305 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:34.320 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Sending command Z3MU?
15:26:34.601 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:34.607 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Cannot send command, no telnet connection
15:26:34.622 [DEBUG] [ernal.telnet.DenonMarantzTelnetClient] - Sending command NSE

Looking at the log it seems I’m having telnet issues. Is there something that’s blocking my telnet connection?

Hard to say. I see the binding is stopped and then started immediately. The log messages of the stopping binding (and disconnecting telnet) and the starting binding seem to happen at the same time (by different threads) which is confusing.
From then on, does the receiver still respond to any command?

Also I tried to telnet from a command line into the receiver and was successful:

matthew@AutomationServer:~$ telnet 192.168.1.52
Trying 192.168.1.52...
Connected to 192.168.1.52.
Escape character is '^]'.

Also the log I posted above was me restarting the binding. So that’s why it stopped and started right away. I restarted the binding to catch the log messages coming out of it.

The receiver still works as normal from the remote. It stopped responding to the phone app but everything on the remote works fine. Like I said I can telnet into it from Linux without problem, it just seems like the binding gets stuck. As you can see above I don’t need any special permissions to use telnet to I don’t think that’s where it’s hung up.

Apparently the issue resolved when I restarted the receiver by unplugging it and plugging it back in again. I think it may have been an issue when I opened the app on my phone. I think it kicked the telnet connection off in openhab. I’ll test again and see what happens but I think the best plan is to not use the app if you’re using Openhab.

Ok, good to hear!
I have used below script in the past to multiplex the telnet of the AVR. Connect openHAB and your app to this process (running on other host).

#!/usr/bin/python2

import sys, time
from daemon import Daemon
from telnet import MyDebugServerFactory, MyProxyClientFactory, MyProxyServerFactory
from twisted.internet import reactor

class TelnetMultiplexer(Daemon):

    #-----------------------------------------------------------#
    # Read in command line arguments
    def run(self):
        remote_ip        = "192.168.178.14"
        remote_port      = 23
        local_port       = 23
        local_debug_port = 1357
        my_client = MyProxyClientFactory()
        my_server = MyProxyServerFactory()
        my_debug  = MyDebugServerFactory()
        my_server.local_server  = my_client
        my_server.debug_clients = my_debug
        my_client.local_clients = my_server
        my_client.debug_clients = my_debug
        reactor.connectTCP(remote_ip, remote_port, my_client)
        reactor.listenTCP(local_port, my_server)
        reactor.listenTCP(local_debug_port, my_debug)
        reactor.run()

if __name__ == "__main__":
    daemon = TelnetMultiplexer('/tmp/daemon-example.pid')
    if len(sys.argv) == 2:
        if 'start' == sys.argv[1]:
            daemon.start()
        elif 'stop' == sys.argv[1]:
            daemon.stop()
        elif 'restart' == sys.argv[1]:
            daemon.restart()
        else:
            print "Unknown command"
            sys.exit(2)
            sys.exit(0)
    else:
        print "usage: %s start|stop|restart" % sys.argv[0]
        sys.exit(2)

Happy to report that this works with my Marantz M-CR611, so thanks for this.

I tried the original Denon binding when I first got it about a year ago and it didn’t work.

1 Like

Hi
nice work @jwveldhuis
My paper UI working perfectly

can you give me some hint how to get it working with homekit ? or is somebody who use this things with apple homekit?

i have my home.items file for NIKO lights working without problem
but when i add this entry for marantz nothing happened

Switch denonmarantz_avr_0005cd7164c8_power “Receiver”
{channel=“denonmarantz_avr_0005cd7164c8_power”}

thanks

Your channel seems wrong to me. Look up the definition in paper UI.
Probably it should be: {channel="denonmarantz:avr0005cd7164c8:power"}

And it’s better to not mix the Items that got automatically created in Paper UI with manually defined items.

So try this:

Switch denon_power "Receiver" {channel="denonmarantz:avr0005cd7164c8:power"}

Thanks for reply
i made changes to my home.items file but still i am unable to see it on may apple homekit app

Have you got other items showing in your home app on your iOS device ie. do you have HomeKit setup and working in openHAB?

The item that jwveldhuis posted above didn’t include the HomeKit tags. You’d have to add the switchable tag before homekit sees it. Sorry if I’m point out the obvious.

1 Like