New binding NAD A/V Receiver

I’m trying to write a binding for my NAD but I’m having trouble with testing it.

I have implemented it and have created the thing and the item and added it to the sitemap and it looks like it is loading ok:

2018-06-23 20:04:54.542 [INFO ] [.e.s.m.c.i.ModelRepositoryImpl:113 ] - Loading model ‘default.sitemap’
2018-06-23 20:04:54.588 [INFO ] [.e.s.m.c.i.ModelRepositoryImpl:113 ] - Loading model ‘nad.things’
2018-06-23 20:04:54.590 [DEBUG] [e.s.m.t.i.GenericThingProvider:263 ] - Read things from model ‘nad.things’
2018-06-23 20:04:54.668 [INFO ] [.e.s.m.c.i.ModelRepositoryImpl:113 ] - Loading model ‘demo.items’
2018-06-23 20:04:54.671 [DEBUG] [.e.s.m.i.i.GenericItemProvider:189 ] - Read items from model ‘demo.items’
2018-06-23 20:04:54.679 [DEBUG] [.e.s.m.i.i.GenericItemProvider:211 ] - Processing binding configs for items from model ‘demo.items’
2018-06-23 20:04:54.680 [INFO ] [smarthome.event.ItemAddedEvent:53 ] - Item ‘NadPpower’ has been added.
2018-06-23 20:04:54.684 [INFO ] [vent.ItemChannelLinkAddedEvent:53 ] - Link ‘NadPpower-nad757:nad757:test:main_control#power’ has been added.

However when I try to toggle the switch I get:

2018-06-23 20:06:21.028 [INFO ] [arthome.event.ItemCommandEvent:53 ] - Item ‘NadPpower’ received command ON
2018-06-23 20:06:21.034 [DEBUG] [e.s.c.t.i.CommunicationManager:321 ] - Received event ‘ON’ for non-existing thing ‘nad757:nad757:test’, not forwarding it to the handler

Any ideas on how to figure out what is going wrong?

I do have this weird error in the log but I think it is not related:

!ENTRY 4 0 2018-06-23 20:04:55.716
!MESSAGE [] The addSitemapProvider method has thrown an exception
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

And as usual I find the solution 5 minutes after I post the question…
I had to add my new binding as a plugin in the openhab launcher.

1 Like

Hi there, is your NAD binding publicly available? Thanks for your quick answer

No, I didn’t get it to work as I wanted to and haven gotten around to fix it yet.
My current solution is that I have a raspberry pi that has a python script to control the NAD and connected it to the NAD with a cheap Chinese usb to serial converter.
I then use the exec binding to send commands to it and poll data.
If you have a computer next to the NAD the extra pi won’t of course not be necessary.

Script that wraps the command script :


import nad757.nad_757_new as NAD
import sys

args = sys.argv
cmd = args[1].lower()

nadCom = NAD.NadCom()

if(cmd == 'power'):
   if(value == '?'):
elif(cmd == 'mute'):
   if(value == '?'):

elif(cmd == 'source'):
   if(value == '?'):
      rsp = nadCom.source()
elif(cmd == 'volume'):
   if(value == '?'):

The script that does the acrual communitaction with the nad:


import sys
import serial
import io

class NadCom:
   def __init__(self):
      self.nad = serial.Serial ("/dev/Nad")
      self.nad.baudrate = 115200
      self.nad.parity = serial.PARITY_NONE
      self.nad.bytesize = serial.EIGHTBITS
      self.nad.stopbits = serial.STOPBITS_ONE
      self.nad.xonxoff = False
      self.nad.rtscts = False
      self.nad.dsrdtr = False
      self.nad.timeout = 5
      self.nad_read = io.TextIOWrapper(io.BufferedRWPair(self.nad, self.nad, 1000),
                                       newline = '\r',
                                       line_buffering = True)
      if(self.nad.isOpen() == False):

   def send(self, command):
      self.nad.write("\r" + command + "\r")

   def read(self):
      rsp = self.nad_read.readline()
      return rsp[:-1]#Strip the trailing '\r' character.

   def power(self, state):
      self.send("Main.Power=" + state)
      return self.getOnOffState("Main.Power")

   def powerState(self):
      return self.getOnOffState("Main.Power")

   def mute(self, state):
      self.send("Main.Mute=" + state)
      return self.getOnOffState("Main.Mute")

   def muteState(self):
      return self.getOnOffState("Main.Mute")

   def getOnOffState(self, field):
      value = self.getValue(field)
      if (value == "Off"):
         return 'OFF'
  if(value == "On"):
     return 'ON'
  return 'Fail'

   def source(self):
      return self.getValue("Main.Source")

   def setSource(self, source):
      self.send("Main.Source=" + source)
      return self.getValue("Main.Source")

   def getVolume(self):
      return self.getValue("Main.Volume")

   def setVolume(self, volume):
      self.send("Main.Volume=" + volume)
      return self.getValue("Main.Volume")

   def getValue(self, field):
      return self.getValue2(field, 10)

   def getValue2(self, field, count):
      if(count == 0):
         return "Fail"
      self.send(field + "?")
      resp ="=")
      while (len(resp) == 2):
         if (resp[0] == field):
            return resp[1]
         resp ="=")
      return self.getValue2(field, count - 1)

   def close(self):

My items:

Switch nadPower "Nad power" (bio_controls) ["Switchable"] {exec="<[ssh automation /usr/share/openhab/python/ power ?:5000:REGEX((.*?))] >[ON:ssh automation /usr/share/openhab/python/ power on] >[OFF:ssh automation /usr/share/openhab/python/ power off]", autoupdate="true"}
Switch nadMute "Mute" (bio_controls) {exec="<[ssh automation /usr/share/openhab/python/ mute ?:5000:REGEX((.*?))] >[ON:ssh automation /usr/share/openhab/python/ mute on] >[OFF:ssh automation /usr/share/openhab/python/ mute off]", autoupdate="true"}
Number nadSource "Source"  {exec="<[ssh automation /usr/share/openhab/python/ source ?:5000:REGEX((.*?))] >[*:ssh automation /usr/share/openhab/python/ source %2$s]", autoupdate="true"}
Number nadVolume "Volume [%ddB]" <soundvolume> {exec="<[ssh automation /usr/share/openhab/python/ volume ?:5000:REGEX((.*?))] >[*:ssh automation /usr/share/openhab/python/ volume %2$s]", autoupdate="true"}

My sitemap settiongs:

Selection item=nadSource icon="source" mappings=[1="Xbmc", 2="AppleTv", 3="Wii", 4="PS4"]
Setpoint item=nadVolume icon="volume" minValue=-99.0 maxValue=15 step=1 visibility=[nadMute==OFF]
Setpoint item=nadVolume icon="mute" minValue=-99.0 maxValue=15 step=1 visibility=[nadMute==ON]
Switch item=nadMute icon=""
Switch item=nadPower icon="power"

Edit: That said I might take up work on the NAD binding again as I will have some time on my hands now.

Thanks for sharing the sources. I’m also hosting my OpenHAB server on a raspberry but do not want to take the “python” approach even if I’m sure it can work well.

I decided months ago to develop my own binding for NAD A/V receivers. I opened a GitLab issue recently and will publish my binding in the coming weeks.

See here:

So far the binding is working well but need to comply to the coding guidelines and execute some more testing before to publish my sources. I own a NAD T758v3 and therefore will only conduct tests on this receiver. If someone owns another receiver and is interested to contributing with some tests, please contact me.

1 Like

I’m new to openhab and I have a NAD C368 with RS232 port. I’ll be pleased to test your addon but I didn’t managed to build your addon, i probably missed some requirements with openhab environment.
I installed openjdk8, maven. I git clone your repo/branch. But when i execute mvn clean install in your addon directory, I get an error :
Missing requirement: org.openhab.core requires 'osgi.service; (objectClass=org.osgi.service.event.EventAdmin)' but it could not be found
So you have any clue ? and anyway I have a running 2.4 OH instance on Synology NAS, will it work ?

I finally managed to compile nadreceiver addon, i had to “convert” it to the new openhab build system. It seems to load in my OH 2.4.
I just ordered a USB to RS232 cable, so i’m waiting for it but do you have any advice for Paper UI confiuration files ?
Note : I followed this thread to “convert” your addon :

A little bit off topic here. But the issue you refered to to “convert” your binding is not updated or using the most efficient way. Since you’ve already migrated the following information is a bit late. But for anyone finding this thread. There is a topic on this forum on how to do the migration:

1 Like

This binding seems not to use RS232 port (I thought so because of the use of Telnet in the description) but it seems it require NAD MDC BluOS extension Card. I read this in PR code : “If you own a NAD receiver such as the T758v3 (together with the BluOS module in that case) and your device is connected to your internal network, this binding is potentially for you.”

You could have look at this project:
It seems to be a MQTT gateway to NAD receives. If you combine this with the MQTT binding maybe it could work for you?

I was inspired by my own suggestion so I made a simple MQTT bridge that I run on the raspberry pi that I have connected to the NAD receiver instead of the earlier python scripts.
I put it on Github in case someone else is interested in it.

I confirm your statement. Previously I owned a NAD T756 and I was already able to use the same Telnet instructions to control it via Ethernet.

Not sure if it’s of interest to anybody, but I managed to put together NAD MQTT bridge in python for “old” binary serial interface used by T*63 and T*73 models (v1.03 circa 2003).
I am using it with serial/IP bridge, but I think it would work for direct serial connection as well with minimal changes.
Not the prettiest code, but works quite well and gets around IR reliability issues.

Just put a binding out there for NAD A/V receivers if there is any interest… Probably should have posted here instead of starting a new thread - New Binding: NAD A/V Receiver Binding.

Thanks Dave, will try it with my serial monster.