SpeakerCraft MZC Control

So I have set aside the ESP32 since that seems to be overly complicated when my Pi4 and MZC are beside each other. I used a USB to DB9 to control jack on the MZC. I installed Matt’s SpeakercraftMediaPlayer using HACS - it looks like it installed correctly. I added the configuration.yaml and it save without errors. But I’m getting this error - any ideas why?:

Logger: homeassistant.components.websocket_api.http.connection
Source: components/hassio/init.py:562
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 3:03:28 PM (1 occurrences)
Last logged: 3:03:28 PM

[547314486816] The system cannot restart because the configuration is not valid: Component error: speakercraft_media - cannot import name ‘Platform’ from ‘homeassistant.const’ (/usr/src/homeassistant/homeassistant/const.py)
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py”, line 185, in handle_call_service
await hass.services.async_call(
File “/usr/src/homeassistant/homeassistant/core.py”, line 1492, in async_call
task.result()
File “/usr/src/homeassistant/homeassistant/core.py”, line 1527, in _execute_service
await handler.job.target(service_call)
File “/usr/src/homeassistant/homeassistant/components/hassio/init.py”, line 562, in async_handle_core_service
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: The system cannot restart because the configuration is not valid: Component error: speakercraft_media - cannot import name ‘Platform’ from ‘homeassistant.const’ (/usr/src/homeassistant/homeassistant/const.py)

Saving is not sufficient to see you have the correct config, you need to use the “check configuration page”, which will give you a similar error to what you are seeing in the logs.

Can you paste you configuration text you are using?

Ideally issues would be tracked by raising an issue on GitHub here Issues · mattsaxon/HASS-SpeakercraftMediaPlayer · GitHub

can you let us know what your configurations is?

Yes, I’m an idiot. I created the file and pasted in the code since I was working it remote on my phone. Thanks for catching it. I’m now able to load the custom component and add the zones to the configuration. I now have them showing up but they are not doing anything.

Should there be any other thing to do inside of Home Assistant or should something happen when the ESP32 is hooked up? I’m thinking something should show up in the Integrations page to then configure? I may also have a hardware issue to troubleshoot but wanted to make sure the HA side was dialed in first.

Getting closer…

Summary of current status of this thread.

This thread is complex as it discusses a number of different approach to Speakercraft integration.

The currently progressing options are;

The code uses a direct serial connection from HA to Speakercraft MZC. It is under active development.

This code uses an MQTT connection from HA to the MZC via an ESP32 providing the remote serial connection. It is working, but not under active development. It is hoped to include the remote capabilities into the first approach in the future.

Neither of these component shows up as an “integration”, you install the manually (or via HACS in first case) and edit configuration.yaml.

If you have issues with either of these specific integrations, please post direct to the GitHub issues pages as community pages are not ideal for complex threaded conversations

In addition to these 2 components, there are 2 discontinued approaches;

  1. A NodeRed prototype implementation - this has been discontinued in favour of the direct approach
  2. A REST API approach using an MZC add-on - this has also been discarded in favour of the MQTT approach

@bigscience it sounds like the HA side is sorted. It will hopefully be posting command to the MQTT server and waiting for zone status. you can test this with a windows mqtt client.

the other side is getting the ESP32 to post the status to MQTT.

the integration wont show up in integrations as its configured in the yaml.

However i’d strongly advice to use the development that @mattsaxon and i are working on, as that is active, and we are progressing well. Although this means the MZC is directly connected to HA. We will hopefully soon, make it so this components can work with a remote unit connected with ESP32, but that requires developing and documenting properly.

OK - I created an issue on GitHub and posted my .log file. Thanks for all your help with this!

@bigscience I wonder if you might consider posting my summary above of the current state of this thread to help any new viewers orientate? Since you own the original post at the top, you could edit it and put a summary of where we are (obviously once we agree its content is accurate)

Good Idea, I edited and added it to the first post. I’d like to preserve what I’d tried out in case it helps someone else down the road.

I’m also thinking it might also be a good idea to branch this thread into 2 new ones that cover the HA and ESP approach, respectively. I can start the ESP one since that’s the route I’m headed and if I can get it to work, post detailed instructions on the setup. I realized today that I think I’m using the wrong pins on the ESP32 so something else to play with tonight.

I really do appreciate all the help everyone is providing. This is great.

@bigscience i wouldnt create a thread for the esp version, as that isnt going to be developed, and hopefully within the next week or so, i hope to have an ESP option in the HA version. So we’re only developing/supporting a single component, We’re adding quite a bit of functionality to the HA version also. Exciting stuff!

Many thanks. Small edit required. The ESP repo doesn’t support HACS at the moment and I see my text/your revised post suggests it does.

Update on remote solution: I’ve successfully tested an off the shelf remote serial solution and documented it in the readme. https://github.com/mattsaxon/HASS-SpeakercraftMediaPlayer/blob/main/README.md

My feeling is that since an off the shelf remote serial works, a custom solution is not required. At least for me in my testing this proved to be the case.

I’m not sure if it will work via WiFi given the likely worse performance. @bigscience would such a solution work, or are you wanting to progress with a customer solution using ESP32?

If you want a cheaper and more DIY solution, I was considering something like this HLK-RM04 TCP IP Ethernet Converter Module Serial UART RS232 to WAN LAN WIFI UK | eBay but overall, I wanted something that had a robust case, so I decided on the easy route!

I’m not married to the idea of an ESP32 solution so if the off the shelf serial work, then that’s great. I just ordered the parts and will give that a go. Thanks for continuing to work on the solution for this.

@mattsaxon Hi…I am trying to implement your great code…but have come up againt an issue I’m not sure how to get around…
I am using an usb ftdi-rs232 adapter to a 3.5mm plug on the control port. I can update the firmware on the speakercraft amp which is an MZC-66.
I can implement the the controls but when it comes to enabling the zones for example
media_player.lounge_speakers
to turn on it just does not respond. I can get the party zone to work and I can see all the zones switch on by the leds on the amp but I can’t get it to switch on via media_player.. any ideas…?
many thanks

No ideas off the top of my head. Can you raise an issue on GitHub and post the debug log and I will take a look

Hello Matt,
Ive just come across your code and im trying to get it to work but im literally stumbling at the first hurdle of adding the code to HA. if you get a chance could you detail how this is done or even send me in the right direction with a search term for google ?

Awesome project you guys, haven’t got it working yet as I need to order some parts to connect from HA to the control port but thanks in advance for all your hard work.

I bought a mzc88 dirt cheap about a year ago but only just got my first set of speakers for it and turned it on the other day to find there’s no way to change the source or anything without the keypads. So I’m excited I found this integration which will hopefully make my amplifier usable.

I’ve managed to add the integration through hacs and edit my config, I just copied the example and I’m now seeing media player entities such as “lounge_speakers”. I can’t test further as I don’t have the right cable yet but I’m assuming once I set up the zones in ez tools and connect to the amp I can turn on media_player.lounge_speakers and adjust the volume and source from within the card? Or through an automation?

The cable seems very hard to find so I might just make one, I plan on buying a 4 pole 3.5mm cable and cut it in half and join onto a DB9 connector and then use a DB9 to USB adaptor to plug into HA. Is this the right approach? I will probably order this today and be testing this out when it arrives.

I needed up having to make cables on my own too. I’ll look around and see it I can find the pin out and post it later.

Here are the parts I used along with a usb adapter and an Ethernet cable:

[StarTech.com - Serial adapter -… https://www.amazon.com/dp/B00006IRQA?ref=ppx_pop_mob_ap_share](StarTech.com - Serial adapter -… https://www.amazon.com/dp/B00006IRQA?ref=ppx_pop_mob_ap_share)

[CESS 5 Pieces 3.5mm 4 Pole TRRS… https://www.amazon.com/dp/B00ZSX53TC?ref=ppx_pop_mob_ap_share](CESS 5 Pieces 3.5mm 4 Pole TRRS… https://www.amazon.com/dp/B00ZSX53TC?ref=ppx_pop_mob_ap_share)

Did you manage to find the pin out? Not much info on the internet around the 4 pole 3.5mm jacks. I was following this diagram but I got to the sleeve wire number 4 and it doesn’t show which pin on the DB9 end.

i’ve found cables on ebay (uk) premade. where are you?

have you tried making a cable from that diagram, it maybe right as serial only needs 3 pins. TX/RX/Ground (to make a common ground).

I think the serial to usb adapter i user would only have the 3 pins connected any way.

Its possible the 4th cable is for a shield in the cable.