From Domoticz
Jump to: navigation, search


Operate the NAD D 7050 Direct Digital Network Amplifier from Domoticz.

Dependencies - hardware / software / operating system

  • NAD D 7050 Direct Digital Network Amplifier
  • python3 (sudo apt-get install python3)

Domoticz Setup - switches, variables, version

  • Setup -> Hardware
  • For type select Dummy
  • Press Add
  • Press the create virtual sensors blue bubble on the new device that appeared on the top
  • Type NADControl for the name and select Selector for the type
  • Press the create virtual sensors blue bubble again
  • Type NADVolume for the name and select Dimmer for the type
  • Go to the switches tab
  • Edit the NADVolume slider and give them an amplifier icon
  • Edit the NADControl button and give it an amplifier icon. Furthermore, link the switches to the commands for the python script as:

NADcontrol content.png

Installation instructions

The NAD 7050 should be connected to the network and have a static IP.

Scripts with comments

A python script sents the commands to the NAD7050. The script must be called with the new volume setting when changing the volume and we use a LUA script for that. This can be done under setup -> more options -> events. Under event name type NAD7050 and select lua instead of blockly. Then paste the following script in the text box:

commandArray = {}
if (devicechanged['NADVolume']) then
    volume = devicechanged['NADVolume']
    os.execute('/home/pi/domoticz/scripts/python/ volume "'..volume..'"')
return commandArray

and press save. Now we still need the python script that actually operates the NAD7050, inspired by the work of Tom Hartley ( *Create the following script named in /home/pi/domoticz/scripts/python

  • Do not forget to change the ip address to match the static IP of your NAD 7050
  • And make the file executable using chmod u+x

TCP_IP = ''
TCP_PORT = 50001

import socket
import sys, time
import codecs

# Function to send codes to the NAD7050
def send(MESSAGE):
    MESSAGE = codecs.decode(MESSAGE, 'hex_codec')
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((TCP_IP, TCP_PORT))

command = sys.argv[1]
if command == 'source':
    channel = int(sys.argv[2])  # Input number from command line
    send('0001020901')  # Switch NAD on
    time.sleep(0.5)  # Otherwise the second connection is refused
    send('000102030' + str(channel))  # Select input
elif command == 'volume':  # Set the volume
    volume_number = sys.argv[2].split(':')[1].split('%')[0]
    volume = 2*int(volume_number)  # NAD volume runs from 0 to 200
    volume_hex = str(hex(volume)[2:]).zfill(2)  # And is entered as hex
elif command == 'off':
    send('00010207010001020207')  # Enable Eco mode
    send('0001020900')  # Off command (no longer reachable by network)
    print('command not recognized')

Example of use


Link to forum posts

Forum topic

The original NAD 7050 reverse engineered code

Homey app for the NAD7050