python-anthemav
python-anthemav copied to clipboard
Support STR pre-amplifier and integrated amplifier
Addresses #38.
The STR pre-amplifier supports four listening modes: Stereo, Mono, Both left and Both right.
It only has one zone.
Minimum and maximum volume is -96.0dB and +7.0dB. Volume can be set in 0.5dB increments. This PR reworks volume_to_attenuation()
and attenuation_to_volume()
to handle this case, while preserving the -90dB to 0dB range of other devices. Note that in doing so we change the type of volume
from int
to float
. Regression testing is advised.
The device supports Home Theatre Bypass mode AKA HTB, in which the output from a separate AV receiver can be connected to the pre-amplifier, which will pass through the signal to the connected power amplifier when the pre-amplifier is in standby mode. HTB inputs are discussed in #38, however they are not able to be selected independently. The official Anthem app does show them in the input list, but fails to switch to them. They don't show up at all on the device front panel. It is therefore probably not a bug that this library cannot select them.
Several commands which apply to AV receivers are not supported by the STR. In particular, BRT
is the read-only bitrate property on a receiver, but the read/write left/right channel balance adjust on the pre-amplifier. The Z1BRT0
commands adjusts balance to the right channel by 0.5dB, Z1BRT50
adjusts by 2.5dB and Z1BRT100
adjusts by 5dB (the maximum), At startup most devices would receive Z1BRT?
to query the current source bitrate, but the STR (probably incorrectly) interprets the command as Z1BRT0
. After instantiating the AVR
class ten times, you would see your pre-amplifier shift the balance fully to the right. We now avoid doing that by adding BRT
to the list of commands which should not be sent at connection startup, as well as other commands which are not mentioned in the documentation from Anthem.