https://www.domoticz.com/wiki/NAD7050
If you happen to have one, give it a try. The main reason for me was that the Android App stopped working with the release of Android Nougat, so I had to get off the couch to set the volume

Moderator: leecollings
Code: Select all
#!/usr/bin/python
TCP_IP = '<IP of your NAD7050>'
TCP_PORT = 50001
BUFFER_SIZE = 1024
import socket
import sys, time
import codecs
def send(MESSAGE):
MESSAGE = codecs.decode(MESSAGE, "hex_codec")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
s.send(MESSAGE)
s.close()
def turnOff():
send("0001020900")
def turnOn():
send("0001020901")
def setVol(n):
send("00010204"+(hex(int(n))[2:]).zfill(2))
if sys.argv[1]=="on":
print ('Turning on')
turnOn()
else:
print ('Turning off')
turnOff()
Code: Select all
#!/usr/bin/python
TCP_IP = '<IP of your NAD7050>'
TCP_PORT = 50001
BUFFER_SIZE = 1024
import socket
import sys, time
import codecs
def send(MESSAGE):
MESSAGE = codecs.decode(MESSAGE, "hex_codec")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
s.send(MESSAGE)
s.close()
def getSetVol(delta): #Fuck yeah magic numbers
MESSAGE = "000102020b000102020400010202060001020207000102020800010202050001020209000102020a000102020c0001020203000102020d00010207000001020800000102020b000102020400010202060001020207000102020800010202050001020209000102020a000102020c0001020203000102020d00010207000001020800"
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
s.send(codecs.decode(MESSAGE, "hex_codec"))
counter = 0
while True:
x = s.recv(1024)
for a in x:
if counter==11:
z = a
s.send(codecs.decode("00010204"+(hex(int(z+delta))[2:]).zfill(2), "hex_codec"))
s.close()
return z
counter += 1
if sys.argv[1]=="up":
getSetVol(6)
elif sys.argv[1]=="down":
getSetVol(-6)
Code: Select all
#!/usr/bin/python
TCP_IP = '<insert your NAD7050 IP>'
TCP_PORT = 50001
BUFFER_SIZE = 1024
import socket
import sys, time
import codecs
def send(MESSAGE):
MESSAGE = codecs.decode(MESSAGE, "hex_codec")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
s.send(MESSAGE)
s.close()
# CMD strings for each input
#0001020300 - Coax 1
#0001020301 - Coax 2
#0001020302 - Opt 1
#0001020303 - Opt 2
#0001020304 - Computer
#0001020305 - Stream
#0001020306 - Dock
#0001020307 - BT
def SelectInput(delta): # magic numbers -> initial string captured in Wireshark
MESSAGE = "000102020b000102020400010202060001020207000102020800010202050001020209000102020a000102020c0001020203000102020d00010207000001020800000102020b000102020400010202060001020207000102020800010202050001020209000102020a000102020c0001020203000102020d00010207000001020800"
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
s.send(codecs.decode(MESSAGE, "hex_codec"))
counter = 0
while True:
x = s.recv(1024)
for a in x:
if counter==46:
z = InputMinMax(a,delta)
s.send(codecs.decode("00010203"+(hex(int(z+delta))[2:]).zfill(2), "hex_codec"))
s.close()
return z
counter += 1
def InputMinMax(a,delta):
# if last input is reached (BT), go back to first (Coax 1) on the next 'up' command. This way you can cycle through the inputs in Domoticz
if (a+delta) == 8:
z = -1
return z
elif (a+delta) == -1:
z = 8
return z
else:
z = a
return z
if sys.argv[1]=="up":
SelectInput(1)
elif sys.argv[1]=="down":
SelectInput(-1)
Code: Select all
#!/usr/bin/python
TCP_IP = '<insert IP NAD D7050>'
TCP_PORT = 50001
BUFFER_SIZE = 1024
import socket
import sys, time
import codecs
def send(MESSAGE):
MESSAGE = codecs.decode(MESSAGE, "hex_codec")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
s.send(MESSAGE)
s.close()
#0001020300 - Coax 1
#0001020301 - Coax 2
#0001020302 - Opt 1
#0001020303 - Opt 2
#0001020304 - Computer
#0001020305 - Stream
#0001020306 - Dock
#0001020307 - BT
def select(n):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
z=0
n=z+1
s.send(codecs.decode("00010203"+(hex(int(n))[2:]).zfill(2), "hex_codec"))
s.close()
def turnOn():
send("0001020901")
if sys.argv[1]=="0":
print ('Selecting Coax 1 input')
# turnOn()
send("0001020300")
# select(0)
elif sys.argv[1]=="1":
print ('Selecting Coax 2 input')
# turnOn()
send("0001020301")
elif sys.argv[1]=="2":
print ('Selecting Optical 1 input')
# turnOn()
send("0001020302")
elif sys.argv[1]=="3":
print ('Selecting Optical 2 input')
# turnOn()
send("0001020303")
elif sys.argv[1]=="4":
print ('Selecting Computer input')
# turnOn()
send("0001020304")
elif sys.argv[1]=="5":
print ('Selecting Stream input')
# turnOn()
send("0001020305")
elif sys.argv[1]=="6":
print ('Selecting Dock input')
# turnOn()
send("0001020306")
elif sys.argv[1]=="7":
print ('Selecting BT input')
# turnOn()
send("0001020307")
Code: Select all
#!/bin/bash
python /opt/domoticz/scripts/python/NADSelectDirect.py "$@"
Code: Select all
commandArray = {}
if (devicechanged['NADVolume']) then
if (devicechanged['NADVolume']=='Off') then
DomValue = 0;
else
DomValue = otherdevices_svalues['NADVolume'];
end
-- print ("Dimmer value= "..DomValue);
CalcValue = (2*DomValue);
os.execute('python /opt/domoticz/scripts/python/NADVolumeDimmer.py '..CalcValue..'&')
-- print("Volume value= "..CalcValue);
end
return commandArray
~
Code: Select all
#!/usr/bin/python
TCP_IP = '<insert IP NAD D7050>'
TCP_PORT = 50001
BUFFER_SIZE = 1024
import socket
import sys, time
import codecs
def send(MESSAGE):
MESSAGE = codecs.decode(MESSAGE, "hex_codec")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
s.send(MESSAGE)
s.close()
def getSetVol(delta): # Wireshark capture initial strings
MESSAGE = "000102020b000102020400010202060001020207000102020800010202050001020209000102020a000102020c0001020203000102020d00010207000001020800000102020b000102020400010202060001020207000102020800010202050001020209000102020a000102020c0001020203000102020d00010207000001020800"
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
s.send(codecs.decode(MESSAGE, "hex_codec"))
counter = 0
while True:
x = s.recv(1024)
for a in x:
if counter==11:
z = a
s.send(codecs.decode("00010204"+(hex(int(delta))[2:]).zfill(2), "hex_codec"))
s.close()
return z
counter += 1
v = sys.argv[1]
getSetVol(v)
Code: Select all
NAD off
http://<domoticz-ip>:8080/json.htm?type=command¶m=switchlight&idx=<ID of NAD7050Control device>&switchcmd=Set%20Level&level=0
NAD on
http://<domoticz-ip>:8080/json.htm?type=command¶m=switchlight&idx=<ID of NAD7050Control device>&switchcmd=Set%20Level&level=10
Input Squeezebox
http://<domoticz-ip>:8080/json.htm?type=command¶m=switchlight&idx=<ID of NAD7050Control device>&switchcmd=Set%20Level&level=20
Input DVD
http://<domoticz-ip>:8080/json.htm?type=command¶m=switchlight&idx=<ID of NAD7050Control device>&switchcmd=Set%20Level&level=30
etc.
Code: Select all
http://<domoticz-ip>:8080/json.htm?type=command¶m=switchlight&idx=<ID of NADVolumeControl device>&switchcmd=Set%20Level&level=66
Code: Select all
http://<domoticz-ip>:8080/json.htm?type=command¶m=switchlight&idx=<ID of NADLouder device>&switchcmd=On
Code: Select all
# standby / on
0001020900 - standby
0001020901 - on
# Standby - 'Network standby' (No powersaving at all) and 'Eco mode' (uses 1W, but can only wake up by button press or IR). NB: it seems these settings are not preserved after poweroff
00010208000001020208 - auto shutoff disabled
00010208010001020208 - auto shutoff enabled
00010207000001020207 - power save disabled
00010207010001020207 - power save enabled
# Network standby
00010208010001020208 - auto shutoff enabled
00010207000001020207 - power save disabled
# Eco standby
00010208010001020208 - auto shutoff enabled
00010207010001020207 - power save enabled
# inputs/sources
0001020300 - Coax 1
0001020301 - Coax 2
0001020302 - Opt 1
0001020303 - Opt 2
0001020304 - Computer
0001020305 - Stream
0001020306 - Dock
0001020307 - BT
0001020203 - poll inputs
0001020209 - poll standby/on state (response: 0001020900 (standby) / 0001020901 (on)
0001020400 - 00010204c8 Volume
0001020400 - volume (min, -90dB)
00010204c8 - volume (max, 10dB)
0001020204 - poll volume
0001020a01 - mute
0001020a00 - unmute
000102020a - poll mute/unmute. Response not muted 0001020a00, muted 0001020a01
Discovery: 224.0.0.251 bonjour/mDNS, UDP port 5353.
Users browsing this forum: No registered users and 0 guests