### Install denonavr Library
Source: https://github.com/ol-iver/denonavr/blob/main/README.md
Instructions for installing the denonavr Python library using pip. It suggests using the --use-wheel flag for potentially faster installation.
```bash
pip install denonavr
```
```bash
pip install --use-wheel denonavr
```
--------------------------------
### Set Source Rename (Python Example)
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Renames an audio source using Python. The example renames the 'DVD' source to 'Test'.
```python
import denonavr
# Assuming you have a receiver object named 'receiver'
# receiver.set_source_rename('DVD', 'Test')
```
```xml
SetSourceRename
Test
```
--------------------------------
### Complete DenonAVR Initialization and Control Workflow
Source: https://context7.com/ol-iver/denonavr/llms.txt
A comprehensive example showing how to initialize the receiver, establish a telnet connection for real-time event monitoring, register callbacks, and execute standard control commands.
```python
import asyncio
import denonavr
async def main():
avr = denonavr.DenonAVR("192.168.1.100")
try:
await avr.async_setup()
await avr.async_telnet_connect()
def on_event(zone, event, param):
print(f"Event: {zone}/{event} = {param}")
avr.register_callback("ALL", on_event)
await avr.async_update()
print(f"Model: {avr.model_name}, Power: {avr.power}")
if avr.power != "ON":
await avr.async_power_on()
await asyncio.sleep(2)
await avr.async_set_input_func("Blu-ray")
await avr.async_set_volume(-40.0)
await avr.async_set_sound_mode("DOLBY DIGITAL")
await asyncio.sleep(60)
finally:
await avr.async_telnet_disconnect()
if __name__ == "__main__":
asyncio.run(main())
```
--------------------------------
### Initialize and connect to a Denon AVR
Source: https://context7.com/ol-iver/denonavr/llms.txt
Demonstrates how to instantiate a DenonAVR object using an IP address and perform the required asynchronous setup to retrieve device metadata.
```python
import asyncio
import denonavr
async def setup_receiver():
# Initialize with IP address
avr = denonavr.DenonAVR("192.168.1.100")
# Optional: Configure with custom name and timeout
avr = denonavr.DenonAVR(
host="192.168.1.100",
name="Living Room AVR",
timeout=5.0,
show_all_inputs=True # Show all inputs including deleted ones
)
# Setup the connection (required before use)
await avr.async_setup()
# Get device information
print(f"Name: {avr.name}")
print(f"Model: {avr.model_name}")
print(f"Manufacturer: {avr.manufacturer}")
print(f"Serial: {avr.serial_number}")
print(f"Zone: {avr.zone}")
print(f"Receiver Type: {avr.receiver_type}")
print(f"Receiver Port: {avr.receiver_port}")
return avr
avr = asyncio.run(setup_receiver())
```
--------------------------------
### Initialize and Update Denon AVR Receiver (Python Async)
Source: https://github.com/ol-iver/denonavr/blob/main/README.md
Demonstrates how to initialize the DenonAVR object with an IP address and perform asynchronous setup and update operations. It shows how to retrieve the current volume level.
```python
import asyncio
import denonavr
d = denonavr.DenonAVR("192.168.1.119")
await d.async_setup()
await d.async_update()
print(d.volume)
```
--------------------------------
### GET /discovery
Source: https://context7.com/ol-iver/denonavr/llms.txt
Discover Denon and Marantz AVR devices on the local network using SSDP.
```APIDOC
## GET /discovery
### Description
Automatically discovers Denon and Marantz AVR receivers on the local network using SSDP broadcast.
### Method
GET
### Endpoint
/discovery
### Response
#### Success Response (200)
- **receivers** (list) - A list of dictionaries containing device information: host, modelName, friendlyName, and serialNumber.
#### Response Example
[
{
"friendlyName": "Living Room AVR",
"modelName": "AVR-X3500H",
"host": "192.168.1.100",
"serialNumber": "123456789"
}
]
```
--------------------------------
### GET: All Zone Source
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Retrieves the current source for all zones.
```APIDOC
## GET /goform/AppCommand.xml
### Description
Retrieves the currently selected source for all zones in the Denon AVR.
### Method
GET
### Endpoint
`/goform/AppCommand.xml`
### Parameters
None
### Request Example
```xml
GetAllZoneSource
```
### Response
#### Success Response (200)
- **rx** (string) - Indicates success, typically "OK".
#### Response Example
```xml
OK
```
```
--------------------------------
### Control Power and Input Function (Python Async)
Source: https://github.com/ol-iver/denonavr/blob/main/README.md
Provides examples of asynchronously controlling the power state (on/off) and changing the input function of the Denon AVR receiver. It demonstrates updating and checking the status after each operation.
```python
await d.async_power_on()
await d.async_update()
print(d.power)
await d.async_power_off()
await d.async_update()
print(d.power)
print(d.input_func)
await d.async_set_input_func("Phono")
print(d.input_func)
```
--------------------------------
### Set Input Function
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Changes the current input source for the specified zone. Example sets the 'Main' zone to 'TV'.
```xml
SetInputFunction
Main
TV
```
--------------------------------
### Execute Custom HTTP Commands on Denon AVR
Source: https://context7.com/ol-iver/denonavr/llms.txt
Demonstrates how to send raw HTTP GET commands to the receiver's web interface using the async_get_command method. This is useful for executing specific commands not covered by the standard library API.
```python
import asyncio
import denonavr
async def custom_commands(avr):
await avr.async_setup()
# Send raw HTTP GET command
response = await avr.async_get_command("/goform/formiPhoneAppDirect.xml?PWON")
print(f"Response: {response}")
# Query current state
await avr.async_get_command("/goform/formiPhoneAppDirect.xml?PW?")
await avr.async_get_command("/goform/formiPhoneAppDirect.xml?MV?")
await avr.async_get_command("/goform/formiPhoneAppDirect.xml?SI?")
asyncio.run(custom_commands(avr))
```
--------------------------------
### GET: All Zone Stereo
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Retrieves stereo settings for all zones.
```APIDOC
## GET /goform/AppCommand.xml
### Description
Retrieves the stereo settings configuration for all zones in the Denon AVR.
### Method
GET
### Endpoint
`/goform/AppCommand.xml`
### Parameters
None
### Request Example
```xml
GetAllZoneStereo
```
### Response
#### Success Response (200)
- **rx** (string) - Indicates success, typically "OK".
#### Response Example
```xml
OK
```
```
--------------------------------
### GET: Sound Mode
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Retrieves the available sound modes for configuration.
```APIDOC
## GET /goform/AppCommand0300.xml
### Description
Retrieves the list of available sound modes (e.g., movie, music, game) that can be configured on the Denon AVR.
### Method
GET
### Endpoint
`/goform/AppCommand0300.xml`
### Parameters
None
### Request Example
```xml
GetSoundMode
```
### Response
#### Success Response (200)
- **rx** (string) - Indicates success, typically "OK".
#### Response Example
```xml
OK
```
```
--------------------------------
### Control Denon AVR Sound Modes
Source: https://context7.com/ol-iver/denonavr/llms.txt
This snippet demonstrates how to control the sound modes on a Denon AVR. It shows how to check for support, get the current mode, list available modes, and set specific sound modes like STEREO, DOLBY DIGITAL, and DTS SURROUND. Ensure the denonavr library is installed.
```python
import asyncio
import denonavr
async def sound_mode_control(avr):
await avr.async_setup()
await avr.async_update()
# Check if sound mode is supported
if not avr.support_sound_mode:
print("Sound mode not supported")
return
# Get current sound mode
print(f"Sound mode: {avr.sound_mode}")
print(f"Raw sound mode: {avr.sound_mode_raw}")
# List available sound modes
print("Available sound modes:")
for mode in avr.sound_mode_list:
print(f" - {mode}")
# Set sound mode
await avr.async_set_sound_mode("STEREO")
await avr.async_set_sound_mode("DOLBY DIGITAL")
await avr.async_set_sound_mode("DTS SURROUND")
await avr.async_set_sound_mode("MCH STEREO")
await avr.async_set_sound_mode("DIRECT")
await avr.async_set_sound_mode("PURE DIRECT")
# Common sound modes:
# "STEREO", "DIRECT", "PURE DIRECT", "MCH STEREO"
# "DOLBY DIGITAL", "DTS SURROUND", "AURO3D"
# "MUSIC", "MOVIE", "GAME"
# "ROCK ARENA", "JAZZ CLUB", "VIRTUAL"
asyncio.run(sound_mode_control(avr))
```
--------------------------------
### GET: Quick Select Name
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Retrieves the name of the Quick Select for a specified zone.
```APIDOC
## GET /goform/AppCommand.xml
### Description
Retrieves the name associated with the Quick Select feature for a specified zone (e.g., "Main").
### Method
GET
### Endpoint
`/goform/AppCommand.xml`
### Parameters
#### Query Parameters
- **zone** (string) - Required - The name of the zone (e.g., "Main").
### Request Example
```xml
GetQuickSelectName
Main
```
### Response
#### Success Response (200)
- **rx** (string) - Indicates success, typically "OK".
#### Response Example
```xml
OK
```
```
--------------------------------
### GET: Input Signal Information
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Retrieves information about all input signals.
```APIDOC
## GET /goform/AppCommand0300.xml
### Description
Retrieves information about all available input signals on the Denon AVR.
### Method
GET
### Endpoint
`/goform/AppCommand0300.xml`
### Parameters
None
### Request Example
```xml
GetInputSignal
```
### Response
#### Success Response (200)
- **rx** (string) - Indicates success, typically "OK".
#### Response Example
```xml
OK
```
```
--------------------------------
### Display and Interface Control for Denon AVR
Source: https://context7.com/ol-iver/denonavr/llms.txt
Control the receiver's display dimmer, navigate the on-screen menu, and manage front panel settings. This example demonstrates how to toggle the dimmer, set specific brightness levels, perform menu actions like moving up/down/left/right, entering selections, going back, and accessing info/options menus. It also covers quick select presets and panel/remote control locking mechanisms.
```python
import asyncio
import denonavr
async def display_control(avr):
await avr.async_setup()
await avr.async_update()
# Dimmer control: "Off", "Dark", "Dim", "Bright"
print(f"Current dimmer: {avr.dimmer}")
await avr.async_dimmer_toggle()
await avr.async_dimmer("Bright")
await avr.async_dimmer("Dim")
await avr.async_dimmer("Dark")
await avr.async_dimmer("Off")
# On-screen menu navigation
await avr.async_settings_menu() # Open settings menu
await avr.async_cursor_up()
await avr.async_cursor_down()
await avr.async_cursor_left()
await avr.async_cursor_right()
await avr.async_cursor_enter()
await avr.async_back()
await avr.async_info()
await avr.async_options()
# Settings menu state (telnet only)
print(f"Settings menu open: {avr.settings_menu}")
# Quick select presets (1-5)
await avr.async_quick_select_mode(1) # Recall preset 1
await avr.async_quick_select_memory(1) # Save to preset 1
# Panel lock controls
await avr.async_panel_lock("Panel") # Lock front panel
await avr.async_panel_lock("Panel + Master Volume")
await avr.async_panel_unlock()
# Remote control lock
await avr.async_remote_control_lock()
await avr.async_remote_control_unlock()
asyncio.run(display_control(avr))
```
--------------------------------
### Denon AVR MITM Network Spoofing Setup (Linux)
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
This code demonstrates setting up a Linux machine for Man-In-The-Middle (MITM) network traffic interception to capture Denon AVR commands. It involves enabling IP forwarding and using `arpspoof` to redirect traffic between a phone and the AVR. Ensure to replace IP addresses with your network's specific configurations.
```bash
sudo sysctl -w net.ipv4.ip_forward=1
sudo arpspoof -i eth0 -t 192.168.0.101 -r 192.168.0.119
```
--------------------------------
### GET: All Zone Volume
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Retrieves the volume level for all zones.
```APIDOC
## GET /goform/AppCommand.xml
### Description
Retrieves the current volume level for all zones in the Denon AVR.
### Method
GET
### Endpoint
`/goform/AppCommand.xml`
### Parameters
None
### Request Example
```xml
GetAllZoneVolume
```
### Response
#### Success Response (200)
- **rx** (string) - Indicates success, typically "OK".
#### Response Example
```xml
OK
```
```
--------------------------------
### Denon AVR Input Source Selection (Python)
Source: https://context7.com/ol-iver/denonavr/llms.txt
Select and manage input sources for the Denon AVR. This includes getting the current input, listing available inputs, setting a new input source, and retrieving media information for network sources.
```Python
import asyncio
import denonavr
async def input_control(avr):
await avr.async_setup()
await avr.async_update()
# Get current input source
print(f"Current input: {avr.input_func}")
# List all available input sources
print("Available inputs:")
for input_name in avr.input_func_list:
print(f" - {input_name}")
# Set input source (use names from input_func_list)
await avr.async_set_input_func("Blu-ray")
await avr.async_set_input_func("TV AUDIO")
await avr.async_set_input_func("Media Player")
await avr.async_set_input_func("Bluetooth")
# Common input sources include:
# "CD", "Phono", "Tuner", "DVD", "Blu-ray", "TV AUDIO",
# "CBL/SAT", "Media Player", "Game", "AUX", "Bluetooth",
# "Online Music", "Internet Radio", "USB/IPOD"
# Get currently playing media info (for network sources)
if avr.input_func in avr.playing_func_list:
print(f"Title: {avr.title}")
print(f"Artist: {avr.artist}")
print(f"Album: {avr.album}")
print(f"Image URL: {avr.image_url}")
# For tuner input
if avr.input_func in ["Tuner", "TUNER"]:
print(f"Band: {avr.band}")
print(f"Frequency: {avr.frequency}")
print(f"Station: {avr.station}")
asyncio.run(input_control(avr))
```
--------------------------------
### GET: Audyssey Information
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Retrieves Audyssey settings including EQ name, value, dynamic EQ, and dynamic volume.
```APIDOC
## GET /goform/AppCommand0300.xml
### Description
Retrieves detailed Audyssey equalization and dynamic volume settings from the Denon AVR.
### Method
GET
### Endpoint
`/goform/AppCommand0300.xml`
### Parameters
None
### Request Example
```xml
GetAudysseyInfo
```
### Response
#### Success Response (200)
- **rx** (string) - Indicates success, typically "OK".
#### Response Example
```xml
OK
```
```
--------------------------------
### Configure Denon AVR Audyssey Settings
Source: https://context7.com/ol-iver/denonavr/llms.txt
This snippet shows how to configure Audyssey MultEQ, Dynamic EQ, and Dynamic Volume settings on a Denon AVR. It includes examples for enabling/disabling Dynamic EQ, setting MultiEQ modes, adjusting Reference Level Offset, and setting Dynamic Volume levels. Requires the denonavr library.
```python
import asyncio
import denonavr
async def audyssey_settings(avr):
await avr.async_setup()
await avr.async_update_audyssey()
# Dynamic EQ on/off
print(f"Dynamic EQ: {avr.dynamic_eq}")
await avr.async_dynamic_eq_on()
await avr.async_dynamic_eq_off()
await avr.async_toggle_dynamic_eq()
# MultiEQ modes: "Off", "Flat", "L/R Bypass", "Reference", "Manual"
print(f"MultiEQ: {avr.multi_eq}")
print(f"Available: {avr.multi_eq_setting_list}")
await avr.async_set_multieq("Reference")
await avr.async_set_multieq("Flat")
# Reference Level Offset: "0dB", "+5dB", "+10dB", "+15dB"
print(f"Reference Level Offset: {avr.reference_level_offset}")
print(f"Available: {avr.reference_level_offset_setting_list}")
await avr.async_set_reflevoffset("0dB")
# Dynamic Volume: "Off", "Light", "Medium", "Heavy"
print(f"Dynamic Volume: {avr.dynamic_volume}")
print(f"Available: {avr.dynamic_volume_setting_list}")
await avr.async_set_dynamicvol("Medium")
await avr.async_set_dynamicvol("Off")
asyncio.run(audyssey_settings(avr))
```
--------------------------------
### GET: Source Rename Information
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Retrieves information about source renaming on the AVR.
```APIDOC
## GET /goform/AppCommand0300.xml
### Description
Retrieves information related to source renaming configurations on the Denon AVR.
### Method
GET
### Endpoint
`/goform/AppCommand0300.xml`
### Parameters
None
### Request Example
```xml
GetSourceRename
```
### Response
#### Success Response (200)
- **rx** (string) - Indicates success, typically "OK".
#### Response Example
```xml
OK
```
```
--------------------------------
### HDMI and Video Settings Configuration
Source: https://context7.com/ol-iver/denonavr/llms.txt
Configure HDMI output selection, audio decode modes, and video processing settings for the Denon AVR. This example shows how to set the HDMI output to different ports or auto, choose between 'AMP' or 'TV' for HDMI audio decoding, and select video processing modes like 'Auto', 'Game', 'Movie', or 'Bypass'. It also includes functions to enable or disable HDMI CEC control.
```python
import asyncio
import denonavr
async def hdmi_settings(avr):
await avr.async_setup()
# HDMI output selection: "Auto", "HDMI1", "HDMI2"
print(f"HDMI output: {avr.hdmi_output}")
await avr.async_hdmi_output("Auto")
await avr.async_hdmi_output("HDMI1")
# HDMI audio decode: "AMP", "TV"
print(f"HDMI audio decode: {avr.hdmi_audio_decode}")
await avr.async_hdmi_audio_decode("AMP")
# Video processing mode: "Auto", "Game", "Movie", "Bypass"
print(f"Video processing: {avr.video_processing_mode}")
await avr.async_video_processing_mode("Auto")
await avr.async_video_processing_mode("Game") # Low latency
# HDMI CEC control
await avr.async_hdmi_cec_on()
await avr.async_hdmi_cec_off()
asyncio.run(hdmi_settings(avr))
```
--------------------------------
### Get Sound Mode List
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Fetches the list of available surround sound modes for a given genre.
```APIDOC
## GET /api/getSoundModeList
### Description
Retrieves the list of available surround sound modes for the current selected genre (music, movie, game, pure).
### Method
GET
### Endpoint
/api/getSoundModeList
### Parameters
#### Query Parameters
- **genrelist** (string) - Optional - Can be used to filter or specify genres, though often left empty to get all available modes.
### Request Example
```json
{
"genrelist": ""
}
```
### Response
#### Success Response (200)
- **genrelist** (object) - A list of available sound modes, each with `listno`, `dispname`, and `selected` status.
#### Response Example
```json
{
"genrelist": [
{
"listno": 1,
"dispname": "Stereo",
"selected": "0"
},
{
"listno": 2,
"dispname": "Dolby Digital",
"selected": "0"
}
]
}
```
```
--------------------------------
### GET: Video Information
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Retrieves video information including output and HDMI signal status.
```APIDOC
## GET /goform/AppCommand0300.xml
### Description
Retrieves video-related information such as video output status and HDMI signal status (input and output) from the Denon AVR.
### Method
GET
### Endpoint
`/goform/AppCommand0300.xml`
### Parameters
None
### Request Example
```xml
GetVideoInfo
```
### Response
#### Success Response (200)
- **rx** (string) - Indicates success, typically "OK".
#### Response Example
```xml
OK
```
```
--------------------------------
### GET: Audio Information
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Retrieves detailed audio information including input mode, signal, and sound type.
```APIDOC
## GET /goform/AppCommand0300.xml
### Description
Retrieves detailed audio information such as input mode, output signal, sound type, and sample rate (fs) from the Denon AVR.
### Method
GET
### Endpoint
`/goform/AppCommand0300.xml`
### Parameters
None
### Request Example
```xml
GetAudioInfo
```
### Response
#### Success Response (200)
- **rx** (string) - Indicates success, typically "OK".
#### Response Example
```xml
OK
```
```
--------------------------------
### Set Firmware Timezone
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Sets the timezone for the receiver's firmware. The example sets the timezone to '38'.
```xml
SetFirmware
38
```
--------------------------------
### Set Source Rename
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Renames an input source. For example, renaming 'DVD' to 'Test'.
```APIDOC
## POST /api/setSourceRename
### Description
Renames an input source on the AVR.
### Method
POST
### Endpoint
/api/setSourceRename
### Parameters
#### Request Body
- **sourceName** (string) - Required - The current name of the source to rename.
- **newName** (string) - Required - The new name for the source.
### Request Example
```json
{
"sourceName": "DVD",
"newName": "Test"
}
```
### Response
#### Success Response (200)
- **status** (string) - Indicates success or failure.
#### Response Example
```json
{
"status": "success"
}
```
```
--------------------------------
### Set Sound Mode - Genre
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Sets the sound mode based on genre. For example, setting to 'Movie' mode.
```APIDOC
## POST /api/setSoundMode
### Description
Sets the sound mode based on a specified genre.
### Method
POST
### Endpoint
/api/setSoundMode
### Parameters
#### Request Body
- **genre** (integer) - Required - The genre code for the sound mode (e.g., 1 for Movie, 4 for Pure Direct).
### Request Example
```json
{
"genre": 1
}
```
### Response
#### Success Response (200)
- **status** (string) - Indicates success or failure.
#### Response Example
```json
{
"status": "success"
}
```
```
--------------------------------
### Get Sound Mode List
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Fetches the list of available surround modes for the current selected genre (music, movie, game, pure). The response contains the list of modes with their display names and selection status.
```xml
GetSoundModeList
```
```xml
GetSoundModeList
2
1
Stereo
0
```
--------------------------------
### Denon AVR XML Query: Input Signal Status (0300 Endpoint)
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
This command uses the `/AppCommand0300.xml` endpoint (`cmd id="3"`) to get the status of all input signals on the Denon AVR. The `GetInputSignal` command is used with the `inputsigall` parameter within a ``.
```xml
GetInputSignal
```
--------------------------------
### POST /setup
Source: https://context7.com/ol-iver/denonavr/llms.txt
Initialize a connection to a specific AVR device using its IP address.
```APIDOC
## POST /setup
### Description
Initializes a DenonAVR instance and performs the setup handshake to retrieve device capabilities and status.
### Method
POST
### Endpoint
/setup
### Parameters
#### Request Body
- **host** (string) - Required - The IP address of the receiver.
- **name** (string) - Optional - A friendly name for the instance.
- **timeout** (float) - Optional - Connection timeout in seconds.
### Response
#### Success Response (200)
- **avr** (object) - The initialized DenonAVR instance containing device metadata and state.
#### Response Example
{
"status": "success",
"device": "AVR-X3500H",
"initialized": true
}
```
--------------------------------
### Configure and control multi-zone AVR settings
Source: https://context7.com/ol-iver/denonavr/llms.txt
Shows how to initialize an AVR with additional zones (Zone 2, Zone 3) and control their power, volume, and input sources independently.
```python
import asyncio
import denonavr
from denonavr.const import ZONE2, ZONE3, ZONE2_ZONE3_NAME
async def setup_multi_zone():
# Initialize with additional zones
avr = denonavr.DenonAVR(
host="192.168.1.100",
add_zones={ZONE2: "Kitchen", ZONE3: "Bedroom"}
)
# Or use predefined constants
# avr = denonavr.DenonAVR("192.168.1.100", add_zones=ZONE2_ZONE3_NAME)
await avr.async_setup()
# Access all zones
zones = avr.zones
for zone_name, zone_instance in zones.items():
print(f"Zone: {zone_name}")
print(f" Name: {zone_instance.name}")
print(f" Power: {zone_instance.power}")
# Control Zone 2 independently
zone2 = zones[ZONE2]
await zone2.async_power_on()
await zone2.async_set_volume(-40.0)
await zone2.async_set_input_func("CD")
return avr
avr = asyncio.run(setup_multi_zone())
```
--------------------------------
### GET: Zone Name
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Retrieves the name of a specific zone.
```APIDOC
## GET /goform/AppCommand.xml
### Description
Retrieves the name assigned to a specific zone in the Denon AVR.
### Method
GET
### Endpoint
`/goform/AppCommand.xml`
### Parameters
None
### Request Example
```xml
GetZoneName
```
### Response
#### Success Response (200)
- **rx** (string) - Indicates success, typically "OK".
#### Response Example
```xml
OK
```
```
--------------------------------
### GET: ECO Mode Status
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Retrieves the status of the ECO mode.
```APIDOC
## GET /goform/AppCommand.xml
### Description
Retrieves the current status of the ECO mode on the Denon AVR.
### Method
GET
### Endpoint
`/goform/AppCommand.xml`
### Parameters
None
### Request Example
```xml
GetECO
```
### Response
#### Success Response (200)
- **rx** (string) - Indicates success, typically "OK".
#### Response Example
```xml
OK
```
```
--------------------------------
### GET: All Zone Mute Status
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Retrieves the mute status for all zones.
```APIDOC
## GET /goform/AppCommand.xml
### Description
Retrieves the current mute status (muted or unmuted) for all zones in the Denon AVR.
### Method
GET
### Endpoint
`/goform/AppCommand.xml`
### Parameters
None
### Request Example
```xml
GetAllZoneMuteStatus
```
### Response
#### Success Response (200)
- **rx** (string) - Indicates success, typically "OK".
#### Response Example
```xml
OK
```
```
--------------------------------
### GET: Active Speaker Information
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Retrieves information about active speakers.
```APIDOC
## GET /goform/AppCommand0300.xml
### Description
Retrieves information regarding the active speakers configured on the Denon AVR.
### Method
GET
### Endpoint
`/goform/AppCommand0300.xml`
### Parameters
None
### Request Example
```xml
GetActiveSpeaker
```
### Response
#### Success Response (200)
- **rx** (string) - Indicates success, typically "OK".
#### Response Example
```xml
OK
```
```
--------------------------------
### Other Asynchronous Control Methods (Python)
Source: https://github.com/ol-iver/denonavr/blob/main/README.md
Lists other available asynchronous methods for controlling sound parameters like bass, treble, and volume, including setting a specific volume level.
```python
# Bass control
d.async_bass_down
d.async_bass_up
# Treble control
d.async_treble_down
d.async_treble_up
# Volume control
d.async_volume_down
d.async_volume_up
d.async_set_volume(50)
```
--------------------------------
### GET: Zone Power Status
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Retrieves the power status for all zones in the AVR.
```APIDOC
## GET /goform/AppCommand.xml
### Description
Retrieves the power status for all zones of the Denon AVR.
### Method
GET
### Endpoint
`/goform/AppCommand.xml`
### Parameters
None
### Request Example
```xml
GetAllZonePowerStatus
```
### Response
#### Success Response (200)
- **rx** (string) - Indicates success, typically "OK".
#### Response Example
```xml
OK
```
```
--------------------------------
### Set Quick Select
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Selects a quick access preset. Accepts values from 1 to 4.
```xml
SetQuickSelect
Main
1
```
--------------------------------
### Monitor Denon AVR Receiver with Telnet (Python Async)
Source: https://github.com/ol-iver/denonavr/blob/main/README.md
Shows how to establish a Telnet connection to the Denon AVR receiver for real-time event monitoring. It includes setting up an update callback function to process status changes.
```python
import asyncio
import denonavr
d = denonavr.DenonAVR("192.168.1.119")
await d.async_setup()
await d.async_telnet_connect()
await d.async_update()
def update_callback(zone, event, parameter):
print("Zone: " + zone + " Event: " + event + " Parameter: " + parameter)
d.register_callback("ALL", update_callback)
```
--------------------------------
### Denon AVR XML Query: Quick Select Name
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
This XML snippet queries the name of a Quick Select setting for a specific zone (e.g., 'Main') on the Denon AVR. It uses the `/AppCommand.xml` endpoint (`cmd id="1"`) with the `GetQuickSelectName` command and specifies the target zone.
```xml
GetQuickSelectName
Main
```
--------------------------------
### Denon AVR XML Command Structure
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
This illustrates the fundamental XML structure for sending commands to a Denon AVR. Commands are enclosed within `` tags, with a `` element specifying the command ID (1 for /AppCommand.xml, 3 for /AppCommand0300.xml). Sub-elements like ``, ``, or `` define the specific action and parameters.
```xml
Set%s
value
```
```xml
SetSurroundParameter
1
```
```xml
SetChLevel
SR
24
```
--------------------------------
### POST /zones
Source: https://context7.com/ol-iver/denonavr/llms.txt
Configure and control independent audio zones (Main, Zone 2, Zone 3).
```APIDOC
## POST /zones
### Description
Manages multi-zone configurations, allowing independent control of power, volume, and input sources for secondary zones.
### Method
POST
### Endpoint
/zones
### Parameters
#### Request Body
- **zone_id** (string) - Required - The identifier for the zone (e.g., 'ZONE2', 'ZONE3').
- **power** (boolean) - Optional - Set power state.
- **volume** (float) - Optional - Set volume level.
- **input** (string) - Optional - Set input source.
### Response
#### Success Response (200)
- **status** (string) - Confirmation of the command execution for the specified zone.
```
--------------------------------
### Command Structure
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Details the XML structure for commands sent to the Denon AVR.
```APIDOC
## Command Structure
### Description
Commands are sent as XML payloads within a `` tag. The structure includes a command ID, a command name, and either a list of parameters or a single value.
### XML Structure
```xml
%s
...
...
```
### Command ID Mapping
- `id="1"`: Corresponds to the `/goform/AppCommand.xml` endpoint.
- `id="3"`: Corresponds to the `/goform/AppCommand0300.xml` endpoint.
### Command Name Format
The `` tag typically uses the format `Set%s` for setting parameters (e.g., `SetSurroundParameter`) or a descriptive name for getting information (e.g., `GetZoneName`).
```
--------------------------------
### Denon AVR XML Query: Audyssey Information (0300 Endpoint)
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
This command uses the `/AppCommand0300.xml` endpoint (`cmd id="3"`) to retrieve detailed Audyssey settings from the Denon AVR. It requests parameters such as EQ name, EQ value, dynamic EQ, and dynamic volume.
```xml
GetAudysseyInfo
```
--------------------------------
### Control Mute Function (Python Async)
Source: https://github.com/ol-iver/denonavr/blob/main/README.md
Illustrates how to asynchronously mute and unmute the Denon AVR receiver using the `async_mute` method.
```python
await d.async_mute(True)
await d.async_mute(False)
```
--------------------------------
### Denon AVR Power Control (Python)
Source: https://context7.com/ol-iver/denonavr/llms.txt
Control the power state of the receiver, including turning it on, off (standby), and managing eco and standby timers. It also shows how to retrieve the current power and device states.
```Python
import asyncio
import denonavr
async def power_control(avr):
await avr.async_setup()
await avr.async_update() # Refresh current state
# Check current power state: "ON", "STANDBY", or "OFF"
print(f"Power state: {avr.power}")
print(f"Device state: {avr.state}") # "on", "off", "playing", "paused"
# Power on the receiver
await avr.async_power_on()
# Power off (standby)
await avr.async_power_off()
# Set eco mode: "On", "Auto", "Off"
await avr.async_eco_mode("Auto")
print(f"Eco mode: {avr.eco_mode}")
# Set auto standby timer: "OFF", "15M", "30M", "60M", "2H", "4H", "8H"
await avr.async_auto_standby("60M")
print(f"Auto standby: {avr.auto_standby}")
# Set sleep timer (minutes): "OFF" or 1-120
await avr.async_sleep(30)
print(f"Sleep timer: {avr.sleep}")
asyncio.run(power_control(avr))
```
--------------------------------
### HDMI and Video Settings
Source: https://context7.com/ol-iver/denonavr/llms.txt
Configures HDMI output routing, audio decoding, and video processing modes.
```APIDOC
## POST /hdmi/output
### Description
Sets the active HDMI output port for the receiver.
### Method
POST
### Endpoint
async_hdmi_output(output)
### Parameters
#### Request Body
- **output** (string) - Required - One of: "Auto", "HDMI1", "HDMI2"
### Request Example
await avr.async_hdmi_output("HDMI1")
```
--------------------------------
### Set Input Function
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Changes the current input source for the Main zone. Accepts source names like 'TV'.
```APIDOC
## POST /api/setInputFunction
### Description
Changes the current input source for a specified zone.
### Method
POST
### Endpoint
/api/setInputFunction
### Parameters
#### Request Body
- **zone** (string) - Required - The zone to change the input for (e.g., "Main").
- **value** (string) - Required - The name of the input source to switch to (e.g., "TV").
### Request Example
```json
{
"zone": "Main",
"value": "TV"
}
```
### Response
#### Success Response (200)
- **status** (string) - Indicates success or failure.
#### Response Example
```json
{
"status": "success"
}
```
```
--------------------------------
### Set Quick Select
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
Sets the Quick Select channel for the Main zone. Accepts values 1, 2, 3, or 4.
```APIDOC
## POST /api/setQuickSelect
### Description
Sets the Quick Select channel for the Main zone.
### Method
POST
### Endpoint
/api/setQuickSelect
### Parameters
#### Request Body
- **zone** (string) - Required - The zone to set (e.g., "Main").
- **value** (integer) - Required - The Quick Select channel number (1-4).
### Request Example
```json
{
"zone": "Main",
"value": 1
}
```
### Response
#### Success Response (200)
- **status** (string) - Indicates success or failure.
#### Response Example
```json
{
"status": "success"
}
```
```
--------------------------------
### Real-Time Telnet Monitoring with Callbacks
Source: https://context7.com/ol-iver/denonavr/llms.txt
Connect to the Denon AVR via Telnet to receive real-time status updates and event notifications through callback functions. This snippet shows how to register callbacks for various events like volume changes, mute status, input selection, power state, and sound mode, as well as how to send raw Telnet commands and manage the connection.
```python
import asyncio
import denonavr
async def telnet_monitoring(avr):
await avr.async_setup()
# Define callback function for events
def status_callback(zone: str, event: str, parameter: str):
print(f"[{zone}] {event}: {parameter}")
# Register callbacks for specific events
avr.register_callback("MV", status_callback) # Volume changes
avr.register_callback("MU", status_callback) # Mute changes
avr.register_callback("SI", status_callback) # Input changes
avr.register_callback("PW", status_callback) # Power changes
avr.register_callback("MS", status_callback) # Sound mode changes
# Or register for ALL events
avr.register_callback("ALL", status_callback)
# Connect to telnet interface
await avr.async_telnet_connect()
# Check connection status
print(f"Telnet connected: {avr.telnet_connected}")
print(f"Telnet healthy: {avr.telnet_healthy}")
print(f"Telnet available: {avr.telnet_available}")
# Send raw telnet commands
await avr.async_send_telnet_commands("MV?", "SI?")
# Keep running to receive events
try:
while True:
await asyncio.sleep(1)
except KeyboardInterrupt:
# Unregister callbacks
avr.unregister_callback("ALL", status_callback)
# Disconnect telnet
await avr.async_telnet_disconnect()
asyncio.run(telnet_monitoring(avr))
```
--------------------------------
### Denon AVR Wireshark Filter Configuration
Source: https://github.com/ol-iver/denonavr/blob/main/doc/XML_data_dump.txt
This snippet provides a Wireshark filter to capture network traffic directed at a Denon AVR. It initially filters for HTTP and XML traffic to a specific IP address, excluding commands related to zone and input status, and is later simplified to exclude any command containing 'Get'. This filter is useful for understanding AVR responses and debugging communication.
```text
http and xml and ip.dst==192.168.0.119 and !(xml.cdata contains "GetAllZoneSource"
or xml.cdata contains "GetAllZone" or xml.cdata contains "GetActive"
or xml.cdata contains "GetInput" or xml.cdata contains "GetVideo")
```
```text
!(xml.cdata contains "Get")
```