I’m very interested in this as audio is very important for me.
Before investing time in this can I just confirm my understanding
I can via Home Assistant control which input is played through which C4 amp output?
I often play the same input on multiple outputs. Can I do this with component as well?
I’m on controller v2.3. From what hi understand this is not relevant
There’s an official C4 integration that requires OS3+. Can this and the official integration coexist or is this nonsensical given it supports audio control?
I’m interested here as I want to move away from C4. However rather than replacing the expensive light and audio the idea is to control from HA
Yes, you can control any audio input to output to any zone. I straddled both systems (C4 and Home Assistant) during the testing. When I wrote this there was no way to interface with C4 to control lights and anything else with Home Assistant, and quite frankly, C4 is very limiting. I dumped C4 completely and replaced everything and sold everything (with the exception of the AMP and Tuner).
garage_c4_input Does this define the garage zone? Are these the audio sources you have connected to audio in on your C4 amp? How are they mapped; i.e. is Tuner mapped do audio in 1 and Volumio to audio in 2? Also this means you have an unused audio in?
What’s the meaning of garage_amp_input? I can also see that you have different options; e.g. 1,3,4 for garage, 2,3,4 for gr and lanai
I have both analogue and digital (Squeezebox) audio in. From memory you have to tell the C4 amp whether an input is analogue or digital and so may have to use a different udp_send command. Do you have this as well and if yes are you simply handling it at the C4 amp end via static setting as opposed to programmatically?
garage_c4_input, is just that, it’s the audio input for the garage zone (ie. audio input 1, 2, 3, 4).
Mine are mapped a little differently. The garage uses it’s own tuner (c4 dual tuner), and the great room and lanai use the other tuner (sharing) because we often go outside and it’s the same music there, but for each the rooms (zones) can have different input (tuner, MP3, or bluetooth). The great room uses 2 zones (it’s quite large and handles 4 8" ceiling speakers (cost me $300 each), but it’s also hooked to my TV (1 zone in the great room) for surround sound behind the theater seating.
I wasn’t using digital and I don’t really recall if I had to specify.
Ok, have made a start here and most works like a charm. Thanks for this! Brings this component smack in the middle of Home Assistant.
However there are two zones that don’t work properly (amp on/off doesn’t work and in another case amp off affects the volume of another zone). I know this is clearly a setup issue but after a few hours I stopped looking at the code as I couldn’t see anything wrong with it.
So I have enabled logging in the init.py file but I don’t get any amp on/off events in the log (the other events get logged - amp volume, amp input). Does logging work in your case?
Also on a separate note I noticed the following in the log
2021-05-31 23:10:05 ERROR (MainThread) [homeassistant.loader] No 'version' key in the manifest file for custom integration 'c4_services'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'c4_services'
No idea what this refers to but it would be a pity not to be able to use this pretty much from the next release
The logging was commented out with " # ", so just uncomment it (remove it) and you’ll get logging.
You can add a version key in the manifest file and it’ll continue to work, it’s just python code.
Add this to the manifest file under “name” and you should be all set:
“version”: “1.1”,
I haven’t spent much time with Home Assistant (upgrading it) as I have to redo all of my zwave stuff to the new zwave.js and I haven’t had any time lately.
I have uncommented all logging statements and get amp volume change and amp input change events but just no amp on/off events so I was wondering whether this is my setup or something else.
You may not be getting logging if the zone isn’t setup correctly. Give yourself a day and look at the code again when you’re fresh, you’re probably overlooking something simple.
I updated the manifest file, so you can download it and replace it (then reboot / restart) and you should be all set.
You’re probably right. The fact that 2 zones work fine means it has to be a code issue when I adopted your code. Will check later whether the amp on/off events get logged for the zones that work alright.
Looking at your code again and would like to confirm the following
Output zones
Garage = zone 1
Great Room = zones 3&4
Lanai = zone 2
I don’t have a tuner but leaving the tuner code there shouldn’t matter, right? I’d like to get this going first before stripping back the code.
In configuration.yaml you have different options for amp input; e.g.
garage_amp_input:
name: Zone Input
options:
- 1
- 3
- 4
or
gr_amp_input:
name: Zone Input
options:
- 2
- 3
- 4
Given this is a matrix amp why wouldn’t this be the same list; e.g. 1/2/3/4?
Looking at the C4 app on my iPad other than the volume there doesn’t seem to be any communication back to C4. Not that that’s an issue as I’ll eventually sunset that.
Lastly, I installed your code, changed the IP address to the amp and uncommented the logging statements. Still don’t see any amp on/off events. However I see amp vol and amp input events. This may not be an issue if I can get the code to work which is where the above confirmation of zones come in
I would strip the code for the tuner if you’re not going to use it as it just creates bloat.
The amp input is different because they use different tuners and I didn’t need to expose those options for either zone.
It would serve you well to go over the code again (to better understand it), then modify it to fit your needs. I could easily fix it for you in a matter of minutes (based on your setup), but then that serves no purpose of you learning and understanding what the code does. If you learn it, then you can modify it in the future for any changes you might have.
If parts of the code confuse you, I can answer those questions.
Agree with you. Unless I get this done myself I don’t learn Thanks for the support here
I went back to the original code and only changed the IP.
Selecting ‘Tuner’ (i.e. input 1 on my C4 amp) as the audio input selects the correct D1 input on the C4 amp. However the same input ‘Tuner’ selects A2 on the other zones (gr and lanai). Where is this mapping determined?
The python code essentially sets up the UDP commands to be sent to the C4 amp
So I would assume this mapping is in automations.yaml. However I don’t see any different mappings between the different zones
Lastly the …_c4_input sections in configuration.yaml are also the same
Selecting ‘Tuner’ (i.e. input 1 on my C4 amp) as the audio input selects the correct D1 input on the C4 amp. However the same input ‘Tuner’ selects A2 on the other zones (gr and lanai). Where is this mapping determined?
The gr (great room) & lanai both use the same tuner input. That mapping is done in the automations.
Since the amp doesn’t understand what Tuner means (it only understands numeric values of 1 → 4) the automations file contains a “conversion” (it’s the input override) so when you select tuner (or whatever other input) it correlates that to a number that gets inserted via the services (init.py).
I always set the volume back to a lower level (when turning on or off) as I had kids living in the house and they would blast the music and scare the crap out of my wife when she went to turn it on, so those numbers always drop the volume to a respectable level and don’t shock anyone. All my kids have grown up and moved out, but I left that code ion for a “safety” if you will…
Finally got everything working. cheers mate! Also bringing in my AVR and TV which will then allow me to create an automation to turn on everything in one go. However I need IR control via the C4 controller for which I’ve created a new post.
However regarding this integration; while everything works one thing is strange. Say I play a source on Master and then switch it off - volume goes back to 0.04 (left that in) and the zone should switch off. After that I move the volume back up to say 0.5. The sound plays even though the switch is still off. So it appears the zone is still on.
I have enabled all logging and I can see events in the log for volume changes and audio input changes but not for amp on/off.
I’m pretty certain that the lovelace config of the switches is correct (I’m using input_boolean.switch_state_1 etc. for the switch) unless that’s not correct
NOTE: Just found the issue. I was indeed using the wrong entity; was suppoed to be switch.master_switch etc.
All works now. btw, it may be useful to add the relevant section of a lovelace card adding the relevant entities. While it may be obvious it certainly caught me out
Good. While I could make the config “plain jane” this was based off my working config, and others will change the config to suit their own needs. You got it running for your setup and it works, but it was a steep learning curve, but you got it working and now you understand it.
When I was building and testing it took me the better part of 2 weeks to figure it all out and get it working.