nugget / python-anthemav

Python asyncio module to interface with Anthem AVM and MRX receivers
MIT License
15 stars 24 forks source link

Add support for MDX multi-zone amplifiers #15

Closed joth76 closed 2 years ago

joth76 commented 4 years ago

(posting this partly as a placeholder to coalesce interest and discuss possible approach to tackle it) The new MDX-8 and MDX-16 multi-zone amps are intended for whole-house audio and of great interest for home assistant automation control systems; the obvious path to adding it is via this component given its use in HA.

The MDX RS232/TCP protocol is forked from the MRX protocol, as currently supported by this component https://www.anthemav.com/downloads/MDX-IP-RS232.xlsx (from https://www.anthemav.com/support/manuals-literature.php)

I'm not (yet) familiar enough with either protocol to analyse how far they have diverged, so not obvious whether a fork of this component, a run-time mode within this one to configure device type, or just a simple case of extending the component to support union of the features.

Obviously making any progress would be gated on having a developer with access to one of these devices, depending how that works out may also guide the "extended vs fork" question too.

(For my part, I don't yet have an MDX but strongly considering getting one; lack of HA support is a key part of that decision process. Technically I am up to developing the support, but not sure what my timeline would be for doing so)

joth76 commented 3 years ago

Small update: I now have access to an MDX-16 so intend to start working on this at some point. No specific timeline, but just flagging here in case anyone else is interested we can converge efforts here.

joth76 commented 3 years ago

On an initial look, this feature breaks down into two fairly distinct items:

  1. multi zone support
  2. MDX protocol command set support

Adding the correct command support is fairly straight forward due to unsupported commands / responses being very gracefully handled by both the client and the amplifier, but multizone support probably needs some more involved refactoring as currently the AVR class largely represents one zone and it would be better factored out to a single AmplifierHost object representing global state (model number, standby state, etc) and N Zone objects each of which encapsulates the state of a given zone (on/off, volume, input, etc etc). This refactor is complicated by the fact there's only minimal test code, and I don't have an MRX device to test changes against :) so I'll likely fork a version for MDX and leave converging it back to someone with access to the MRX.

dwbrock62 commented 3 years ago

Any progress on this one? I just ordered the MDX16 and would really like to have ability to turn off/on/mute and control volume of each zone. I'm a software engineer but no experience in HA and only smattering of Python (but experience with many other languages) so I have a steep learning curve in order to contribute.

joth76 commented 3 years ago

I've stopped looking at this for now at least 1/ The way the current code is structured, it's hard to add multi zone support with fairly substantial class refactoring to split out "zones" from "AVR global" functionality. I could take that on, but don't have the original AVR devices this was designed for, to test I've not broken anything 2/ I'd like to add automated tests for the existing as as well as new functionality (to avoid having to have all hardware variants to test any change), but that further increases the size of the job 3/ It turns out I can easily get all the functionality I need (volume & mute, really) directly from my Loxone home control system, so adding support in HA as a higher level media automation controller is much lower priority for me

Hyralex commented 3 years ago

I might add multizone to support zone 2 of the MRX, and could look at the same time to make it compatible with the MDX. Looking at the commands, some change might be needed for controlling the volume.

I do not have an MDX, only the MRX520 to test, so I would need to rely on somebody willing to test it for me before making an official release for the MDX.

dwbrock62 commented 2 years ago

I have the MDX16 (actually Martin Logan MDA16, but same device) up and running with 3 zones currently - 2 more zones to come soon. I would definitely be willing to test. Do you plan on adding support for matrix switching? I don't currently have a need for it yet (single source to all zones). But I could easily add another source so that I could test that too if you plan to implement.

In the interim I have cobbled together a crude interface using switches and sensors that send commands to the MDA16 using UNIX command "echo | nc", and then using value_template to parse the return values. Works OK, but would be nice to have a proper integration.

image

Jeremiah164 commented 2 years ago

I have the MDX16 (actually Martin Logan MDA16, but same device) up and running with 3 zones currently - 2 more zones to come soon. I would definitely be willing to test. Do you plan on adding support for matrix switching? I don't currently have a need for it yet (single source to all zones). But I could easily add another source so that I could test that too if you plan to implement.

In the interim I have cobbled together a crude interface using switches and sensors that send commands to the MDA16 using UNIX command "echo | nc", and then using value_template to parse the return values. Works OK, but would be nice to have a proper integration.

image

Any chance you'd be able to share the code you used to create that? I'm considering purchasing the MDX16 but would need to integrate it with Home Assistant.

Hyralex commented 2 years ago

Good news. Support for multi-zone and MDX and MDA (Martin Logan equivalent) is in progress. A beta version is available if you want to give a try. The Home Assistant custom components to use is here: https://github.com/Hyralex/hass-anthemav