Skip to content

Instantly share code, notes, and snippets.

@coralmw
Created October 13, 2015 19:38
Show Gist options
  • Save coralmw/17be7546b8ac0a9798ca to your computer and use it in GitHub Desktop.
Save coralmw/17be7546b8ac0a9798ca to your computer and use it in GitHub Desktop.
Changes the volume of a denon network-attached receiver.
"""Trivial app to change the volume of my denon reciever from my laptop.
"""
import telnetlib
import sys
if __name__ == "__main__":
if len(sys.argv) < 2:
print("""USAGE: dvol [0-100]""")
sys.exit()
verbose = len(sys.argv) == 3
HOST = "192.168.0.111"
tn = telnetlib.Telnet(HOST)
# valid range: 10-80
vol = ((float(sys.argv[1])/100*70)+10)
if vol < 10:
vol = 10
command = 'MV{}\r'.format(int(vol))
if verbose: print 'command',command
tn.write(command)
if verbose: print(tn.read_until('\r', timeout=1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment