/python-anthemav-serial

Python RS232 API for Anthem A/V Receivers and Pre-Amps

Primary LanguagePythonMIT LicenseMIT

Python RS232 API for Anthem Receivers and Pre-Amplifiers

NOTE: THIS DOES NOT WORK YET!

Library for controlling Anthem receivers and pre-amplifiers (e.g. Statement D2) via RS232 serial connections. The structure of this library is based off pymonoprice.

Supported Anthem Models

This currently only supports Anthem models which communicate using Anthen's original RS232 serial Gen1 interface. For later models (while the Gen2 serial interface is still unsupported), the IP-based 'python-anthemav' library for communicating can be used.

Model(s) Series Series Const RS232 IP
Statement D2, D2v, D2v 3D d2 ANTHEM_D2 Gen1 none
Statement D1 d1 ANTHEM_D1 Gen1 none
AVM 20 avm20 ANTHEM_AVM20 Gen1 none
AVM 30 avm30 ANTHEM_AVM30 Gen1 none
AVM 50, AVM 50v avm50 ANTHEM_AVM50 Gen1 none
MRX 300, MRX 500, MRX 700 mrx ANTHEM_MRX Gen1 none
AVM 60 avm60 ANTHEM_AVM60 Gen2 Gen2
MRX 310, MRX 510, MRX 710 mrx1 ANTHEM_MRX1 Gen2 Gen2
MRX 520, MRX 720, MRX 1120 mrx2 ANTHEM_MRX2 Gen2 Gen2
STR amplifiers str ANTHEM_STR Gen2 Gen2

The list of series constants are enumerated in the SUPPORTED_ANTHEM_SERIES variable.

Usage

from anthemav_serial import get_amp_controller, ANTHEM_D2

serial_port = '/dev/ttyUSB0'
amp = get_amp_controller(ANTHEM_D2, serial_port)

amp.mute_on(1)

See also example.py for a more complete example.

Usage with asyncio

With the asyncio flavor, all methods of the controller objects are coroutines:

import asyncio
from anthemav_serial import get_async_amp_controller, ANTHEM_D2

async def main(loop):
    amp = await get_async_amp_controller(ANTHEM_D2, '/dev/ttyUSB0', loop)
    await amp.set_power(zone, False)

loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))

Known Issues

  • deadlock during communication (MAJOR ISSUE)
  • cannot query the existing state of the pre-amps (e.g. current volume, sources, etc)

See Also

Details on RS232 protocol: