It’s not an actual working component yet, just a Python library. I gotta implement more functions in the library, then use the library to create a HA component.
Thanks on the info i will try it when its ready. What do you plan to integrate? Only lights, thermostats and volume from rooms or also AV part?
That’s awesome. Wish my python was a little more up to speed. I’ll take a look at it. Do you know which versions of director expose this API? I’m sitting on 2.10.5 permanently, or at least until I detach AV control from C4 (wife uses the gui frequently, don’t know why since there are 5 other easier ways to use it, but it goes away in 3+).
I don’t use Control4 for AV control - what features are you talking about?
I have a feeling this new REST API was implemented for the new Control4 OS 3 app, but if you want to test it out you can try cloning my repo then running the included test.py
on a system with Python 3.8 installed. You’ll also need to create a file called login_info.py
that looks like this:
username: [email protected]
password: control4password
If that doesn’t work, I’m pretty sure the pre-OS 3 systems are using the old C4SOAP API, which is documented here: https://github.com/lawtancool/pyControl4-SOAP
While all the command names are similar and this legacy API is still exposed on my 3.0 system, I decided against developing this API further because it seems insecure (I can send commands without any authentication ) and therefore likely to be removed by Control4 in the future.
Changing Source of the TV, playing music etc…
I spent the weekend heavily modifying media_player to support my Triad audio matrix, which requires that you treat the devices differently. This change enables source selection and correctly sets the state to idle or on (so the HA UI reflects the matrix state accurately). Based on some of the lines that were commented out in media_player I suspect this had been attempted before (the output and volume offsets of 3000 and 1900 are giveaways). Anyway, happy to share if anyone thinks it might be useful. The caveat is that I haven’t cleaned up the code or attempted to separate it into a new module - I just overwrote media_player. To do it properly an audio matrix should be a different entity. There’s also a few magic numbers (e.g. the offsets I mentioned above), but I don’t know if there’s an elegant way around those given the way C4 handles their internal states.
EDIT: Maybe you wouldn’t want a different entity. The UI should be the same whether it’s a true media_player or just an audio matrix entry. It could be a hidden implementation detail within the custom media_player…
Years ago C4 controllers supported a SOAP interface on port 5020, which also supported event notification and programming through AddCodeItem. For instance:
<c4soap name="GetVersionInfo" async="False">
</c4soap>
<c4soap name="EnableEvents", async="True">
<param name="enable" type="bool">1</param>
</c4soap>
<c4soap name="GetItems", async="False">
<param name="filter" type="number">0</param>
</c4soap>
They also supported SSDP device discovery so that one could just do a UDP broadcast, though it didn’t quite follow the specification. For instance:
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 5
ST: c4:director
Are these no longer supported? I don’t have access to h/w any longer so I can’t check.
Could you upload your code to GitHub? I don’t have an audio matrix, but I’m curious to see how you implemented it.
@coolTNT sorry, I never got around to testing this with mine, rough few months. I see this got included in 0.114 as an official integration, congrats! Is it just lights for now? Any confirmation if it works pre OS 3?
It only shipped with lights in 0.114, but I’ve already opened a PR for alarm control panel and binary sensors: https://github.com/home-assistant/core/pull/38703
I’m pretty sure this only works on OS 3.0+, but I have not had the chance to try it on OS 2.
@coolTNT thanks for your Control4 integration. I’ve been using it successfully for a couple months now for my Control4 dimmers and thermostats.
I haven’t had any luck with the alarm control panel with my DSC alarm system. I get errors about async calls timing out. Not sure what the issue is but I’m fine without it as I am using a REST command in HA to the webevents driver in Control4 to arm the security system.
I had a couple suggestions regarding the thermostat. I have a 2 stage AC compressor and had to update the STATE_MAPPING variable to include a couple additional strings:
STATE_MAPPING = {
"Off": CURRENT_HVAC_IDLE,
"" : CURRENT_HVAC_IDLE,
"Cool": CURRENT_HVAC_COOL,
"Stage 1 Cool": CURRENT_HVAC_COOL,
"Stage 1 and 2 Cool": CURRENT_HVAC_COOL,
"Heat": CURRENT_HVAC_HEAT
}
otherwise it would not recognize that my AC was on.
Also, I’m wondering what would be needed to add humidity support? It looks like the base HA Core ClimateDevice class supports it. I have a dehumidifier I’d like to control. When I get some time, I was thinking of extending and testing C4ClimateDevice to handle humidity control as I have some basic Python experience.
Thanks!
To make the alarm control panel work you need to be using Control4 alarm “proxy v2” drivers, instead of v1. There should be one available in Composer Pro for DSC.
If you want to get humidity numbers from Control4, you could see if its available as a variable for your thermostat device (see https://github.com/itsfrosty/control4-2way-web-driver for how to list variables) then copy some of the existing code to read that new variable and report it as humidity to Home Assistant.
@coolTNT sorry, I don’t understand about the alarm driver. I’m using a DSC IT-100 serial driver from Domosapiens to control my DSC alarm system. Not sure what proxy driver you’re referring to. I don’t see anything like that in Composer Pro. I must not be looking in the right place.
As for humidity numbers, yes, I’ve figured out the proper variables for the current and target values. When I get some time to play around with the driver, I’ll add the necessary retrieval. Thanks!
@eblau I’m pretty sure I’m using the driver for IT-100 listed here: https://drivers.control4.com/solr/drivers/browse?&q=&fq=manufacturer:“DSC”
@coolTNT I haven’t had time to mess with the alarm driver, but I did just submit a pull request on Github for 2-stage cooling and humidity control support. I tested it on my Control4 system running 2.10.2.
My thermostats all support reporting the current humidity and I have one thermostat configured to drive the whole house dehumidifier. I added a config option to denote the climate entity that supports target humidity. Please take a look and let me know if it seems ok to you:
One thing I could not figure out how to do is to control the dehumidifier by setting an hvac mode. In Control4 it is configured separately from the main hvac mode so I could not figure out how to integrate that properly.
Reporting of the dehumidifier being on seems to be wrong from the Control4 side.
If the the thermostat starts the dehumidifier without calling for cooling, it reports “Dehumidifying Equipment Wait”. If the thermostat calls for both cooling and drying, it reports “Stage 1 Cool” or “Stage 1 and 2 Cool” but after cooling stops, if the dehumidifier continues to run, Control4 reports “Off” as the state.
Even the Control4 app shows state like this. Not sure how to get past this other than to upgrade the Control4 side in search of a bug fix.
Interesting topic
I try to understand this a bit better before going to my installer. I’m running Control4 OS 2.6 so have to upgrade to 3.0. Given this is chargeable service I’d like to understand whether it’s worth it.
I started my home automation journey with C4 back in 2012. The fact that you have to approach a dealer for changes really doesn’t sit well with me especially now with systems like Home Assistant, custom built devices on ESP32/ESP8266 and Tasmota etc.). For the last 9 or so months I have started to build a new system around Home Assistant, Node-RED, AWS and recently stumbled upon the C4 integration when I built a HA instance on a VM running on Ubuntu64.
My ideal target model is to retain C4 but eventually control everything through Home Assistant. I’m running dimmer lights, the lounge (AVR), sound through the house (via a 4 channel audio matrix) and integration to a security system (e.g. motion to light). So direction of control eventually is from Home Assistant to C4 with status messages coming back to HA.
Is this possible with the components/bits available today? Don’t expect it to be plug-and-play but would be nice to get a feel of whether this is doable.
Got this integration working with OS 3.1.3, and everything works very well. Only thing missing would be Door Lock support - anyone working on this?
So I’m a complete noob to Home Assistant and trying to add this to my project but keep getting errors. I’m not sure if it’s my error or not. First off, is this the same Control4 project that’s included with the OS? The documentation for the version in GitHub says it works for 2.x, but the official version says 3.x is required? Also, can someone provide an example configuration.yaml file? I think the errors I’m getting are related to my formatting and syntax of that file. Thanks for your help.