Home Assistant direct control of Control4 AMP and Tuner (no plugin needed)


With help from others and examples from Matt @ Smart(ish) Home (with OpenHab and Home Assistant) I’ve created scripts that directly control the Control4 (4) zone Multiplexer Amp and Tuner (no need for the Control4 controller).

I went away from Control4 (as it is limited and expensive) and moved to Home Assistant.

The scripts are easy to manipulate to your setup and if you have any questions don’t hesitate to ask.

Fairly new to HA. Any instructions on how this extension is installed?

If you read github with the code it explains it pretty well. Do some reading as far as adding a package/addon manually (which is what this is), and then read the instructions for the C4 I created and the rest is pretty self explanatory…

Don’t be intimidated, it’s really easy (I’ve done all the heavy lifting already). After you understand the packages you’ll see it shouldn’t take more than 15 minutes to have it up and running.

Good luck!

I have read/played around but I am definitely not doing something right. Where are the instructions? There is this on github, but looks like it is about updating rather than installing…

Stop Home Assistant
Remove/Rename/Delete c4_services.py
Copy the c4_services folder into the custom_components folder
Open __ init __.py (underscore underscore init underscore underscore.py) and change the IP Address of your AMP and Tuner in all instances.
Start Home Assistant

If successful, a __ pycache __ (underscore underscore pycache underscore underscore) folder will be automatically created registering the c4_services.

What I did so far is:

  • updated init.py for my IP address,
  • couldn’t find a custom_components folder so I created one in the config directory, in the addons directory and at the root home directory and then put the c4_services subfolder and the 3 files in each of these locations,
  • copied the contents of configuration.yaml and automations.yaml from github to the corresponding files in the config directory

When checking the configuration under Server Controls, Configuration, Check Configuration, it checks out as valid. I also now see the automations under Configuration, Automations. However, I get the following notification:

Invalid config

The following integrations and platforms could not be set up:

* c4_services

Please check your config.

So I am doing something wrong. I did search around but haven’t found any good information on manually installing addons.

So I figured out that the custom_components folder needs to be created under the config directory. I checked everything again and was missing an _ in the name of the init.py file so it seems to be loading correctly now. I do see a pycache file in /config/custom_components/c4_services directory so that seems to be a good sign.

I tried executing the various automations that were created just to turn on/off zones or set the volume to 0. I am getting that the command was sent in the log file and it looks like a response. But so far nothing happening with the amp.

Something like…

Command sent. Response: 0r2a42 000
3:35:14 PM – c4_services (WARNING) - message first occurred at 3:34:28 PM and shows up 8 times

Sending command: 0s2a40 c4.amp.chvol 02 a9
3:35:14 PM – c4_services (WARNING) - message first occurred at 3:34:32 PM and shows up 5 times

there is supposed to be 2 underscores before init and 2 underscores after init (before the period).

Do you have the amp and tuner, or just a tuner?

Just the C4 AMP, no tuner. The input (Pandora, Shairbridge, Radio, etc.) all comes form a EA3 controller which is connected via Digital Coax to input 1 on the C4 AMP.

You’ll have issues then. What I wrote controls the amp and you don’t use the C4 controller for any inputs. All inputs come directly into the amp itself. If you have a newer amp it may not work for your setup. I have an older C4 amp.

This selects the input and output channels and sets the volume.

The AMP should be older. I think the prior own put this system in around 2010. I said HDMI in my previous post but it is actually Digital Coax. I don’t think the amp is capable of streaming services. Per the EA3 datasheet from control4, the EA3:

Streaming services: Pandora®, Napster®, Spotify Connect, TuneIn, TIDAL, Deezer
ShairBridge: Up to 20 instances of the driver in the project; 3 concurrent streams

I am pretty sure my C4 AMP is just an amplified matrix like you said where you select the input and the output(s). I have also seen on forums that he EA3, in order to use all 3 of the streams, has to be hooked up by HDMI, coax, and analog … each one carrying a different streaming service. I only use one at a time since I only have the coax connected and the AMP does not have HDMI in.

Ok. if they all come into 1 digital then you’d have to use the controller to switch outputs (not sure how’d you’d be able to do that). Are you going to keep the C4 controller or dump it? If keeping it, I’m not sure what this will do for you, but if you’re dumping the C4 controller, next thing is to get your new inputs working (for whatever media you use like a bluetooth input, mp3 player (I use Daphile)… and the like.

If you have an older amp like me then this will work fine. Did you put the switches into your config file? You’ll have to remove everything for the tuner…

So I am working on dumping the EA3. The only thing left that it does is control the amp and stream music since we do use the home audio system. If I can replace the controller with something else to control the amp (i.e. Home Assistant), I can hook the input 1 up to something else to provide the audio content. Haven’t gotten that far yet as this is all part of me looking into the possibilities. As far as I could tell, your addon is the only “replacement” for Control4 in order to continue to use the amp.

I did add the switches to the config file so those are showing up as entities in HA.

Ok. Send me pics of the back of your amp (to confirm it’s sthe same I have), and then I can write a custom setup for you. You can send the pics in a private message. If you’re dumping the controller you’ll have to get your “other” sources ASAP so we can program it for your setup.

If you look through HA plugin’s and custom stuff, you can find just about everything you need (or want).

The amp is in a rack of media/network equipment and difficult to get a good picture due to the wiring. However it is a C4-8AMP1-B and the inputs are identical to the 4 zone matrix on the datasheet on Control4’s website…

Winner, winner chicken dinner. That’s what I have, so this will work.

Next figure out stuff for your inputs, and then tell me your outputs (rooms I assume). If you have a 4 zone tell me which zones are for what rooms, IP address of the tuner (make sure it’s static), and then what inputs you want (so I can label them). If you want live radio, you can buy a used C4 tuner on ebay cheap like this (not necessarily the one) https://www.ebay.com/itm/Control-4-Multi-Tuner-C4-TUN2-E-B-AM-FM-Dual-Tuner/293663501154?hash=item445fb56b62:g:NIsAAOSwQRNfHMYV

We can make it work. I’m going out for a bit to pick up building supplies.

Zone 1, Outside; Zone 2, Kitchen/Dining; Zone 3, Garage; Zone 4, Master Bedroom

IP address: (static)

I don’t know my inputs yet, TBD on what I connect that is controllable. So Input 1-4 is fine, I could always dive into the configuration to change. I mostly listen to Pandora stations … not so much live radio.

Really appreciate the help!

So I started looking at your code (I was really just trying to see if this worked before) and after looking at it there are really only a couple of commands:

c4.amp.out output input (input 00 to turn off the zone?)
c4.amp.chvol output volume

It looks like there is an acknowledgment of sorts but don’t see anywhere that you poll the amp for current status which is interesting.

After failing to get the addon working, I tried using part of your code directly in Python and was able to change volume on one of my zones. Interesting thing is Control4 updated the current volume when I did this so there is some info likely going back to the Controller/Director in order to update the Navigator display.

I created a script just for turning on / off zones. Based on my testing, it doesn’t look like Control4 is aware of zone changes, but is aware of volume changes. Simple script below…

import logging
import socket
import random
from time import sleep
HOST = ""
PORT = 8750

# Zones
outside = "01"
kitchen = "02"
garage  = "03"
bedroom = "04"

# Inputs
off		= "00"
pandora = "01"
TBD2	= "02"
TBD3	= "03"
TBD4	= "04"

def send_udp_command(command):
    COUNTER = "0s2a" + str(random.randint(10, 99))
    COMMAND = COUNTER + " " + command + " \r\n"
    print("Sending command: ", COMMAND)
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    sock.sendto( bytes(COMMAND, "utf-8"), (HOST, PORT))
    received = str(sock.recv(1024), "utf-8")
    print("Command sent. Response: ", str(received))
def amp_output(output, input):

	send_udp_command("c4.amp.out " + output + " " + input)
def amp_change_volume(output, volume):

	send_udp_command("c4.amp.chvol " + output + " " + volume)

amp_output(outside, off)
amp_output(kitchen, off)
amp_output(garage, off)
amp_output(bedroom, off)

#amp_output(outside, pandora)
#amp_output(kitchen, pandora)
#amp_output(garage, pandora)
#amp_output(bedroom, pandora)

The code doesn’t poll for status (I never needed it), so it sends the raw commands and it does get a response (I have that part commented out (#). It adds alot to the log and I actually have logs shut off (I only turn them on to debug). I’ll create the code so you can easily follow it (since obviously you aren’t a newbee and can understand it). I’ll yank the tuner stuff out… I should have something for you in the morning (spending quality time with the wife).
Bear in mind since it’s a matrix amp you can play any source in any zone, so plan for that accordingly (in the event you want to have pandora playing in 2 different zones with 2 different playlists).

I am no programmer but I have dabbled in writing code for Arduino’s, etc. so know enough to make sense of things.

When you were pulling this together is there some kind of API / list of commands that you are aware of. For example, if I could poll that might be useful. There is a 7" screen in my living room that we use to control the EA3/amp and it works well with Pandora, etc. If I can poll status, I could possibly leave that in tact and also control the amp via HA. I would be interested in understand what else could be done to control / talk to the amp.

Again, thanks for the help!

Control 4 is a commercially sold and commercially (paid) supported solution, and there is no API (one of the reasons I didn’t like it). There are no list of commands to query the controller (that is totally locked down), but how the code was retrieved to control the tuner and the amp was through wireshark.

It took me the better part of 2 weeks to understand and test the commands coming from the C4 controller being sent to the tuner and the amp, and if you’d like to devote the time to learning more commands I applaud you, but I was so pissed at how locked the system was I just wanted to control the amp and tuner and dump the rest of Control 4… period.

HA is 10 times what Control 4 could ever be, and my system has evolved to at least 10 times the size my Control 4 system was with so much more than Control 4 could ever offer at a fraction of the the cost.

If you’re looking to straddle the 2 systems I wish you luck. Adding what you need/want and building what you want specifically is way easier and less time consuming. Everything Control 4 is proprietary and cannot be modified… trust me, I tried any and every angle, and it just wasn’t worth the effort.

Anyhow, send me your email address in a private message, and I’ll send you the modified code to work with your specific system (I’ve already done it for you).

1 Like

I fully understand Control4 and being locked down. It came with the house and I had the installer out because they insisted in order to move the system over to me. Some of the prices they quoted (like $150 per light switch, something like $160 / hr to change anything in the system, etc.) were a real turn-off. I have since taken down most of what the prior owner had which was primarily around media control around the house. With all the streaming TV, harmony hubs, etc. there really wasn’t a need for this centralized control anymore. The only thing that has stayed is the 7" touchscreen in the kitchen and the amp because it actually does a nice job of integrating with Pandora, AirPlay, etc. and controlling the amp/zones. That part it is hard to argue that Control4 doesn’t do a good job. Wishful thinking, I would be happy to keep the amp, EA3 and touchscreen running as is, especially if I could extend control in other ways to the system I use for home automation.

As far as the work involved getting to this I fully appreciate that this is already done and being shared. I was just wondering if there were other commands discovered (by you our someone else) that weren’t being used in your addon.

Thanks again and I appreciate you taking the time to helping me out. I will send you a PM.