Connects to an older Denon AVR serial port using an IP to Serial convertor
This is in no way affiliated with Denon.
I don't have access to a Denon AMP any more directly - so most of this is from old Protocol documentation
This library uses logging
just set the log level and format you need.
The examples below may look a little complex - because this library relies on functions like .connect()
need to be await
ed.
import asyncio
from denon_avr_serial_over_ip import DenonAVR
api = DenonAVR(
host=10.10.10.10,
longitude=5001,
)
async def zone_change(zone):
"""Alert about a zone change"""
_LOGGER.info("Zone %s changed", zone.zone_number)
async def connect_turn_on_z2():
await API.connect()
API.zone2.subscribe(zone_change)
await asyncio.sleep(2)
await API.zone2.turn_on()
await asyncio.sleep(2)
await API.zone2.set_volume_level(0.5)
await asyncio.sleep(2)
await API.turn_off()
asyncio.get_event_loop().run_until_complete(connect_turn_on_z2())