My legacy Rotel RSP-1570 Surround Sound processor has a RJ-45 (RS232) port, so to network enable it, I bought a BF430 Serial Ethernet Converter.
Made a Python script and it turns out working great.
Be aware that the script must be in the config-folder. It will nor work in the python_script or the custom_componet folder.
Sharing this so other who want to send Hex codes to a device can see how it can be done. I am not a developer. It has been a copy-and-paste work, so if you know a better way of doing this. Please enlighten me.
The command line/ shell command looks like this:
> # Switch - command line:
> - platform: command_line
> switches:
> rotel_rsp1570_mute_toggle:
> command_on: "python3 /config/Rotel-RSP1570-remote.py 'unitCommand' 'Mute Toggle'"
> command_off: "python3 /config/Rotel-RSP1570-remote.py 'unitCommand' 'Mute Toggle'"
> friendly_name: Rotel - Mute Toggle
# Shell command:
1570_mute_toggle: "python3 /config/Rotel-RSP1570-remote.py 'unitCommand' 'Mute Toggle'"
Remote control script:
##############################################################################
# ROTEL RSP-1570 - REMOTE - HOME THEATER PROCESSOR #
##############################################################################
import socket
import sys
ROTEL_MODEL = 'Rotel RSP-1570 remote control'
IPADDR = '192.168.0.11'
SERIALPORT = 50000
CONTROLPORT = 51857
def updateSensor(text):
line1 = text[4:25]
line2 = text[25:46]
line3 = text[46:]
def sendHex(HexCode):
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect((IPADDR, SERIALPORT))
s.send(bytes.fromhex(HexCode))
display = s.recv(CONTROLPORT)
s.close()
updateSensor(display)
def unitCommand(action):
switcher = {
#POWER & VOLUME COMMANDS
'Power Toggle' : 'FE 03 A3 10 0A C0',
'Power Off' : 'FE 03 A3 10 4A 00',
'Power On' : 'FE 03 A3 10 4B 01',
'Mute Toggle' : 'FE 03 A3 10 1E D4',
'Volum Up' : 'FE 03 A3 10 0B C1',
'Volum Down' : 'FE 03 A3 10 0C C2',
'Power Off All Zones' : 'FE 03 A3 10 71 27',
#SOURCE SELECTION COMMANDS
'Source Linn Sneaky' : 'FE 03 A3 10 02 B8', #Source CD
'Source Tuner' : 'FE 03 A3 10 03 B9',
'Source Tape' : 'FE 03 A3 10 04 BA',
'Source TV' : 'FE 03 A3 10 05 BB', #Source Video 1
'Source PS4' : 'FE 03 A3 10 06 BC', #Source Video 2
'Source Video 3' : 'FE 03 A3 10 07 BD', #Source Video 3
'Source Video 4' : 'FE 03 A3 10 08 BE', #Source Video 4
'Source Video 5' : 'FE 03 A3 10 09 BF', #Source Video 5
'Source Multi Input' : 'FE 03 A3 10 15 CB',
#SURROUND MODE COMMANDS
'Stereo Bypass Toggle' : 'FE 03 A3 10 11 C7',
'Dolby 3 Stereo' : 'FE 03 A3 10 12 C8',
'Dolby PLIIx Mode Toggle' : 'FE 03 A3 10 13 C9',
'DSP Mode Toggle' : 'FE 03 A3 10 14 CA',
'Dolby 3 Stereo/PLIIxToggle' : 'FE 03 A3 10 53 09',
'dts Neo 6 Music/CinemaToggle' : 'FE 03 A3 10 54 0A',
'DSP 1' : 'FE 03 A3 10 57 0D',
'DSP 2' : 'FE 03 A3 10 58 0E',
'DSP 3' : 'FE 03 A3 10 59 0F',
'DSP 4' : 'FE 03 A3 10 5A 10',
'5 Channel Stereo' : 'FE 03 A3 10 5B 11',
'7 Channel Stereo' : 'FE 03 A3 10 5C 12',
'Dolby PLIIx Cinema' : 'FE 03 A3 10 5D 13',
'Dolby PLIIx Music' : 'FE 03 A3 10 5E 14',
'Dolby PLIIx Game' : 'FE 03 A3 10 74 2A',
'Dolby Pro Logic' : 'FE 03 A3 10 5F 15',
'dts Neo:6 Music' : 'FE 03 A3 10 60 16',
'dts Neo:6 Cinema' : 'FE 03 A3 10 61 17',
'PLII Panorama Toggle' : 'FE 03 A3 10 62 18',
'PLII Dimension Up' : 'FE 03 A3 10 63 19',
'PLII Dimension Down' : 'FE 03 A3 10 64 1A',
'PLII Center Width Up' : 'FE 03 A3 10 65 1B',
'PLII Center Width Down' : 'FE 03 A3 10 66 1C',
'Dolby Digital EX Toggle' : 'FE 03 A3 10 68 1E',
'Next Surround Mode' : 'FE 03 A3 10 22 D8',
#TONE CONTROL COMMANDS
'Treble Up' : 'FE 03 A3 10 0D C3',
'Treble Down' : 'FE 03 A3 10 0E C4',
'Bass Up' : 'FE 03 A3 10 0F C5',
'Bass Down' : 'FE 03 A3 10 10 C6',
'Tone Control Select' : 'FE 03 A3 10 67 1D',
#OSD MENU COMMANDS
'OSD Menu' : 'FE 03 A3 10 18 CE',
'Enter' : 'FE 03 A3 10 19 CF',
'Cursor Right' : 'FE 03 A3 10 1A D0',
'Cursor Left' : 'FE 03 A3 10 1B D1',
'Cursor Up' : 'FE 03 A3 10 1C D2',
'Cursor Down' : 'FE 03 A3 10 1D D3',
#OTHER COMMANDS
'Front Display On/Off' : 'FE 03 A3 10 52 08',
'Party Mode Toggle' : 'FE 03 A3 10 6E 24',
#VOLUME DIRECT COMMANDS
'Volume Min' : 'FE 03 A3 30 00 D6',
'Volume 10' : 'FE 03 A3 30 0A E0',
'Volume 32' : 'FE 03 A3 30 20 F6',
'Volume 40' : 'FE 03 A3 30 28 FD 01',
'Volume 64' : 'FE 03 A3 30 40 16'
}
HexCode = switcher.get(action, 'Error')
if HexCode != 'Error':
sendHex(HexCode)
else:
return False
# Get function name and command from calling program
impFunk = sys.argv[1]
impCom = sys.argv[2]
fm = impFunk + '("' + impCom + '")'
eval(fm)