Denon / Marantz 2.0 Binding

@neohusky

thanks for your helpful hint. that was a reason. i had no tag for homekit … now i can add my receiver…

as i can ask you. What homekit tags do you have by volume? my is [“Lighting”] but this is not the right :slight_smile: . and by input or surround, i am in the corner…, nothing working for me

thanks a lot

Well, I’m not a HomeKit expert… I don’t think controlling receivers to
that detail is supported. Only switches, lights, and thermostats/AC.

Maybe you can control volume as a Light, and control individual inputs as switches. You need to setup ‘virtual switches’ for that, e.g. when the TV switch is enabled, the TUNER switch should be disabled, etc.

Hi @Serrrano

As @jwveldhuis suggested receivers aren’t really supported using HomeKit.

In saying that I have dabbled in using Homekit for Receiver control. I think I used the [“Switchable”] for the Receiver Power and created a Dimmer Item with [“Lighting”] mapped to volume. This way you can say “Siri turn on receiver” and “Siri Turn Receiver Volume to 50%”

Installed 2.3.0-snapshot today.

Initially the binding failed to initialized and after some troubleshooting I found that the binding starts throwing exceptions as soon as I set the volume of zone2 above 70% (showing -10.0dB in the Denon app). This is the exception:

2018-02-20 16:03:45.652 [TRACE] [ector.http.DenonMarantzHttpConnector] - result of getDocument for uri 'http://<snip>:80/goform/formZone2_Zone2XmlStatusLite.xml':
<?xml version="1.0" encoding="utf-8" ?>
<item>
<Power><value>ON</value></Power>
<InputFuncSelect><value>TUNER</value></InputFuncSelect>
<VolumeDisplay><value>Relative</value></VolumeDisplay>
<MasterVolume><value> -5</value></MasterVolume>
<Mute><value>off</value></Mute>
</item>

2018-02-20 16:03:45.671 [ERROR] [ector.http.DenonMarantzHttpConnector] - Error while polling Http: "null". Stacktrace: 
java.math.BigDecimal.compareTo(BigDecimal.java:2625)
org.eclipse.smarthome.core.library.types.PercentType.validateValue(PercentType.java:54)
org.eclipse.smarthome.core.library.types.PercentType.<init>(PercentType.java:50)
org.openhab.binding.denonmarantz.internal.DenonMarantzState.setZone2Volume(DenonMarantzState.java:200)

It seems like the binding is converting the dB value it is receiving in http:///goform/formZone2_Zone2XmlStatusLite.xml into a percentage value and this is failing.

I found out that on my receiver, 80% corresponds to 0dB for zone 2. The Denon app allows to increase zone2 volume to +18.0dB.

About every 10 seconds I see this in the eventlog:

2018-02-20 17:44:31.059 [DEBUG] [ery.DenonMarantzDiscoveryParticipant] - AVR found: 00F76FD52310@<snip>._raop._tcp.local.
2018-02-20 17:44:31.065 [DEBUG] [ery.DenonMarantzDiscoveryParticipant] - This discovered device is not supported by the DenonMarantz binding, ignoring..

Does this mean that the binding is doing a full network scan every 10 seconds?

Let me guess: you created an item manually and used type Dimmer and assigned the dB channel which must be of type Number? :wink:
At least that is a scenario to get this error…

The Discovery is coordinated by the framework, not the binding. I don’t think it is run every 10 seconds. And mDNS is not doing a network scan, it is just listening for broadcasts by compatible devices.

nope. I read your comment somewhere in older topics. I created the items via paper UI. The volume (in%) was created as a dimmer, and I changed it into a number after reading your older comments. The volume in dB was created as number.

Strange: I moved over to HABPanel and there the problem doesn’t happen. Seems like the exception is only triggered when feeding data from the XML to the paper UI.

Anyway, I am not using paper UI for “production” so it won’t bother me again.

OK thanks. These --for me at least-- pretty useless messages were distracting me during debugging of the other issues.

Once a device is known not to be compatible with this binding, this is unlikely to change 10 seconds later. I would suggest this message be moved to the TRACE logging level.

I disagree. The error stresses a configuration error by the user. It causes malfunction (you mapped a Number [-80,12] channel to a 0-100 Dimmer Item, or the other way around). That shouldn’t be hidden in TRACE, nobody enables that for normal debugging.
Will see whether this particular configuration error can be caught and reported in a more understandable way, but more unexpected errors can occur during polling.
This has nothing to do with the Device not being compatible.

@jwveldhuis We actually have two threads ongoing at the same time:

  1. exception thrown when volume exceeds 70%
  2. debug log flooded by messages about incompatible devices

Point 1: I did not make any item mapping manually. I just let de binding do its thing via the Paper UI. So if a wrong item type was created (dimmer vs number), this is must be a software issue. Later yesterday evening I changed my receiver’s “volume scale” setting from dB to percentage. Since then I don’t see this exception appearing any more. But at the same time I moved away from PaperUI to HABPanel for controlling the receiver.

If you want, I can run some test scenarios to help narrow down the issue. I don’t know myself how best approach this. Which scenarios make most sense to you?

I totally agree that any errors/exceptions that happen here, should be shown in full in the logs.

Point 2: Like I said, devices are unlikely to suddenly become compatible with the binding. So I don’t think it makes sense showing this in the debug log every x seconds, x being somewhere between 2 and 30 and not exactly 10 as I reported before.

Ok, yes, apologies for some misunderstanding from my side here. Thank you for clarifying.

@1: when I checked with my AVR, the volume scale setting did not affect the values in the XML (Marantz SR5008). Can you check the XML output for changes in the volume level format (e.g. dB versus relative) after you change the setting in the AVR? If the XML does change I need to fix that in the binding, it currently assumes the value always is in dB (absolute) despite the setting of the volume scale.
/goform/formMainZone_MainZoneXmlStatus.xml

Then check the <MasterVolume> value, whether it is in -80,12 range or 0-100.
Let me know.

@2: I agree now, the message that a device is ignored during Discovery could better be set to TRACE, will change that in the next version. (I misunderstood this was about the error with the item during the polling).

The only thing which changes, is the segment.

When choosing “0-98” scale in the receiver’s settings:

<VolumeDisplay>
<value>Absolute</value>
</VolumeDisplay>

when choosing “-79.5dB -18.0dB”:

<VolumeDisplay>
<value>Relative</value>
</VolumeDisplay>

No other segments are changed. The master volume is always reported in dB:

<MasterVolume>
<value>-50.0</value>
</MasterVolume>

Ok, same here. So that setting has nothing to do with the error you got first. Maybe coincidence it went away after switching.
Thanks for checking!

Last Sunday I discovered that the Denon items were not updating in openHAB. When sending commands from HABPanel, the Denon was reacting to this command, but when I made changes manually on the receiver, then the new state was not reflected in openHAB items.

First, I thought that the Denon was somehow rejecting network connections from openHAB. Using a packet sniffer, I could confirm that there were no connection requests from openHAB to the Denon.

Then, I activated debug logging and restarted the binding. The binding connects to the AVR just once, downloads the 2 XMLs, throws the exception related to Zone 2 volume and then nothing happens any more. Thing remains in status “uninitialized”

Then I deleted all channel links via Habmin and restarted the binding:

2018-02-27 10:44:53.155 [TRACE] [ector.http.DenonMarantzHttpConnector] - Refreshing URL: http://10.0.2.11:80/goform/formZone2_Zone2XmlStatusLite.xml
2018-02-27 10:44:53.166 [TRACE] [ector.http.DenonMarantzHttpConnector] - result of getDocument for uri 'http://10.0.2.11:80/goform/formZone2_Zone2XmlStatusLite.xml':
<?xml version="1.0" encoding="utf-8" ?>
<item>
<Power><value>ON</value></Power>
<InputFuncSelect><value>CD</value></InputFuncSelect>
<VolumeDisplay><value>Absolute</value></VolumeDisplay>
<MasterVolume><value>  0</value></MasterVolume>
<Mute><value>off</value></Mute>
</item>
2018-02-27 10:44:53.204 [DEBUG] [nmarantz.handler.DenonMarantzHandler] - Received state ON for channelID zone2Power
2018-02-27 10:44:53.206 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.denonmarantz.handler.DenonMarantzHandler@1774476': null
java.lang.NullPointerException: null
	at java.math.BigDecimal.compareTo(BigDecimal.java:2625) [?:?]
	at org.eclipse.smarthome.core.library.types.PercentType.validateValue(PercentType.java:54) [109:org.eclipse.smarthome.core:0.10.0.b1]
	at org.eclipse.smarthome.core.library.types.PercentType.<init>(PercentType.java:50) [109:org.eclipse.smarthome.core:0.10.0.b1]
	at org.openhab.binding.denonmarantz.internal.DenonMarantzState.setZone2Volume(DenonMarantzState.java:200) [220:org.openhab.binding.denonmarantz:2.3.0.201802091334]
	at org.openhab.binding.denonmarantz.internal.connector.http.DenonMarantzHttpConnector.updateSecondaryZones(DenonMarantzHttpConnector.java:256) [220:org.openhab.binding.denonmarantz:2.3.0.201802091334]
	at org.openhab.binding.denonmarantz.internal.connector.http.DenonMarantzHttpConnector.refreshHttpProperties(DenonMarantzHttpConnector.java:311) [220:org.openhab.binding.denonmarantz:2.3.0.201802091334]
	at org.openhab.binding.denonmarantz.internal.connector.http.DenonMarantzHttpConnector.refreshState(DenonMarantzHttpConnector.java:178) [220:org.openhab.binding.denonmarantz:2.3.0.201802091334]
	at org.openhab.binding.denonmarantz.internal.connector.http.DenonMarantzHttpConnector.connect(DenonMarantzHttpConnector.java:112) [220:org.openhab.binding.denonmarantz:2.3.0.201802091334]

I then deleted all Denon items. No change, the binding just loads the XMLs once, throws the above exception and exits.

I then deleted the thing and re-added it via Paper UI. Thing is discovered, added and then the binding throws the exception.

I then lowered the Zone 2 volume on the receiver and restarted the binding. Binding started running, requesting status updates from the Denon every 5 seconds. As soon as I increase Zone2 volume above -10db/70%, the binding starts throwing exceptions (remember, no items created yet)

Finally, I deleted the thing again and re-added it using a totally different name to avoid any old channel information to influence. This didn’t help either.

My conclusion for now: the binding itself runs into trouble as soon as the Zone 2 volume exceeds a certain level, regardless whether items are created/linked or not.

Since you mentioned in an earlier post that the volume should not be created as a “dimmer” item, I had a look in the jsondb to see how channels are created by the binding. There I see that the channel is created as a dimmer:

        {
          "acceptedItemType": "Dimmer",
          "kind": "STATE",
          "uid": {
            "segments": [
              "denonmarantz",
              "avr",
              "0005cd3abf39",
              "zone2Volume"
            ]
          },  },

I stopped openHAB, changed the “Dimmer” into “Number” and restarted. This didn’t help: exception as soon as I exceed a certain volume on Zone2. I then compared the channel settings of main volume and Zone 2 volume and found no differences.

Finally, I raised the main volume beyond the 70% point, hoping that I would see the same exception happening there. This was not the case. So there seems to be a difference in the way the main volume channel is pulling its information from the XML.

I am out of inspiration for now. Is there anything else I can try to help you tracking down the issue that seems only to be happening in Zone2 (or probably non-main-zones)?

I may have found something.

Main zone is reporting the volume in the XML as a float:

<MasterVolume>
<value>-49.0</value>
</MasterVolume>

2nd zone is reporting volume in the XML as an int:

<MasterVolume>
<value>-6</value>
</MasterVolume>

Could this explain why cast fails on line 200 in DenonMarantzState.java?

        PercentType newVal = new PercentType(volume);

I tried several settings on the receiver for motivating it to send a float for Zone 2 volume, but didn’t succeed.

No, I meant the volumedB channels (absolute, not relative) must be Number, not Dimmer. The normal Volume channel should be Dimmer (so your example of jsonDB should be fine).

What is done in the binding to convert the absolute (dB) value [-80,+13] is to add 80 (the offset). This should result in a range [0,93] which is valid for PercentType.
Somehow in your case the value seems out of that range, it seems to be null when seeing the stack trace.
I see the volume value has some leading spaces in your case, that might be the issue. Although I can’t explain this behaviour, it should have thrown a NumberFormatException if something was wrong.

I can’t reproduce your error, but just did a small update to the binding (to trim the leading spaces before parsing the volume). Maybe that solves your issue?

This latest version is solving my problem. The whole time is was confused by the way Chrome rendered the XML: it doesn’t display the space. When using curl, it was clear that a space is inserted in the XML zone 2 volume when the figure is less than 2 digits:

[16:10:49] openhabian@openHABianPi:~$ curl http://10.0.2.11/goform/formZone2_Zone2XmlStatusLite.xml
<?xml version="1.0" encoding="utf-8" ?>
<item>
<Power><value>ON</value></Power>
<InputFuncSelect><value>CD</value></InputFuncSelect>
<VolumeDisplay><value>Relative</value></VolumeDisplay>
<MasterVolume><value>-18</value></MasterVolume>
<Mute><value>off</value></Mute>
</item>
[16:11:16] openhabian@openHABianPi:~$ curl http://10.0.2.11/goform/formZone2_Zone2XmlStatusLite.xml
<?xml version="1.0" encoding="utf-8" ?>
<item>
<Power><value>ON</value></Power>
<InputFuncSelect><value>CD</value></InputFuncSelect>
<VolumeDisplay><value>Relative</value></VolumeDisplay>
<MasterVolume><value> -6</value></MasterVolume>
<Mute><value>off</value></Mute>
</item>
[16:11:30] openhabian@openHABianPi:~$ curl http://10.0.2.11/goform/formZone2_Zone2XmlStatusLite.xml
<?xml version="1.0" encoding="utf-8" ?>
<item>
<Power><value>ON</value></Power>
<InputFuncSelect><value>CD</value></InputFuncSelect>
<VolumeDisplay><value>Relative</value></VolumeDisplay>
<MasterVolume><value>-14</value></MasterVolume>
<Mute><value>off</value></Mute>
</item>
[16:11:39] openhabian@openHABianPi:~$ curl http://10.0.2.11/goform/formZone2_Zone2XmlStatusLite.xml
<?xml version="1.0" encoding="utf-8" ?>
<item>
<Power><value>ON</value></Power>
<InputFuncSelect><value>CD</value></InputFuncSelect>
<VolumeDisplay><value>Relative</value></VolumeDisplay>
<MasterVolume><value> -3</value></MasterVolume>
<Mute><value>off</value></Mute>
</item>
1 Like

Just a short question / feature request?

Can I get back a string that would represent RDS info for FM Tuner? I was trying to get back (for BasicUI purposes) a station name but no luck.

Thx.

Hi, there is no way to retrieve it with the binding and there are no plans to support it (there are many other properties, this binding only supports the most common).
You probably need this command: ANNAME?, but the OpenHAB architecture (afaik) doesn’t provide a way to retrieve the result of a custom command. Perhaps you can create a script to fetch the value and then post it to OpenHAB using the RESTful API.