Skip to content

Instantly share code, notes, and snippets.

@sodejm
Created November 25, 2016 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sodejm/0b58f8e78cb8c5e9fc4d58ea44fa01a6 to your computer and use it in GitHub Desktop.
Save sodejm/0b58f8e78cb8c5e9fc4d58ea44fa01a6 to your computer and use it in GitHub Desktop.
Control Denon Receiver Volume with basic script
# requires python 3
# Author: Justin Soderberg
# tested with Denon AVR-X1200W
import sys
import requests
import argparse
# global value for the receivers ip address
receiverIP = '10.10.1.80'
def req_increase(value):
# iterate the amount to increase the volume (for me this is .5db intervals)
for _ in range(value):
# setup the post request, leaving verify false for self signed certs but not currently using SSL
req = requests.post('http://' + receiverIP + '/MainZone/index.put.asp',
data={'cmd0': 'PutMasterVolumeBtn/>', 'cmd1': 'aspMainZone_WebUpdateStatus/'},
verify=False)
req.raise_for_status()
def req_decrease(value):
# iterate the amount to decrease the volume (for me this is .5db intervals)
for _ in range(value):
# setup the post request, leaving verify false for self signed certs but not currently using SSL
req = requests.post('http://' + receiverIP + '/MainZone/index.put.asp',
data={'cmd0': 'PutMasterVolumeBtn/<', 'cmd1': 'aspMainZone_WebUpdateStatus/'},
verify=False)
req.raise_for_status()
if __name__ == "__main__":
try:
# set default to a high number that is not valid to check if it exists,
# I am sure there is a better way than this.
parser = argparse.ArgumentParser(description='Change Volume of Denon Receiver.')
parser.add_argument('-up', '-u', help='Amount to increase volume', type=int, default=555555,
required=False)
parser.add_argument('-down', '-d', help='Amount to decrease volume', type=int, default=444444,
required=False)
args = parser.parse_args()
# set the args
up = args.up
down = args.down
if up is not 555555:
req_increase(up)
elif down is not 444444:
req_decrease(down)
else:
parser.print_help()
except KeyboardInterrupt:
print("Caught KeyboardInterrupt, exiting!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment