[Component] Control4 Integration

A set of custom components to allow integration of Control4 lights, thermostats, security systems and media volume into Home Assistant!

Full details in the GitHub repository: https://github.com/lawtancool/homeassistant-control4

This is currently very beta stage, but appears to work reliably with my setup. I’m not exactly a programmer and mostly cobbled this code together by copying other Home Assistant components, so contributions are welcome!

Currently working:
Lights: on/off, brightness control
Thermostats: ambient temperature display, mode display (but not changing), target temperature changing
Security System: view state (Disarmed, Armed Home, Armed Away)
Media volume: change volume of media in a Control4 room zone

To install the Control4 driver needed for this to work (https://github.com/itsfrosty/control4-2way-web-driver), you need to have access to Control4 Composer Pro (not HE) and a controller (tested on OS 2.9, 2.10). If you currently don’t have Composer Pro on your machine, Google is your friend.

This is based on https://github.com/itsfrosty/homeassistant-control4 , but I added/fixed thermostat, security, and media volume control.

This component is tested working on Home Assistant 0.79.3, and should work on older versions as well.

UPDATE: Home Assistant now has an official Control4 integration: https://www.home-assistant.io/integrations/control4/ Use that one if your Control4 system is on OS 3.0+.

The custom integration in this post still works with OS 2 or 3, and supports climate and media controls which are not available in the official integration.

2 Likes

Gonna test this out! Thanks for sharing.

HI, will this work with the HDMI Matrix as well? Wasn’t sure when you said media volume.

Thanks!!

The media volume works by changing the volume of a media zone (room): if your HDMI matrix is setup as the media source for a room, you can change the volume of that room with this component. Use the proxy_id of the room, not the HDMI matrix itself.

Managed to get this up and running last night after a few false starts (all my own fault).

Just wondering how work on the dimming is progressing? Or am I totally missing something obvious?

Next for me is to finish up the rest of my lights and try out the media volume. I don’t have a hdmi matrix, just a 8 zone c4 amp, but I’ll certainly give it a whirl.

great work all round. thanks.

Dimming should work now - I totally forgot to update the post :sweat_smile:

I have a 4 zone amp so I think yours should work great as well.

Ah, fantastic.

Any difference in config required to enable dimming control? At the moment I’ve only got on/off working by using the sample config you’ve provided -

light:

No, the dimming should be available in the Home Assistant UI no matter what (even if the Control4 switch doesn’t support it, there is no way to check)

To see the dimming slider in Home Assistant, you need to get into the pop-up menu:

Try clicking the bulb icon in the UI, or go to the states dev tool and select your light from there:
image

Hi, this is great news I will try this out today! Just wanted to confirm that this will allow Audio and video control also? I have the the Control4 Audio Matrix and the Control4 HDMI Video Matrix (10x10)(its Leaf with Control4 branding). If so do you know the config for setting these up? Thanks again for supporting this!!

This component can only change the volume: if media is playing in a room, we can change the volume of that room. There is no source selection or anything else, only volume. If anyone knows how to expand this component I welcome contributions :slight_smile:

Seems to be very nice ! Is the communication is 2-way ? Will change made in control4 app like light on-off dimming, etc. Will refresh fast in home assistant ? I want to make a nice dashboard for my home which is better than control4 ui. Thanks ! Could be interested to help you, i’m Not the best programmer but I have good base.

@coolTNT Thanks for your contribution with this. I’m using a modified version of this successfully with HA 0.95.6. I tweaked a few of the variable values you were using to adjust for the F/C values of the thermostat and a few other things, I also adjusted the lighting component a bit to work with a switch… Seems that on the version of my controller I’m running (2.10.5), what you had written would error our in communication with the controller if it was a non dimmer switch… Anyway… not why I post…

Because of the changes introduced to the Climate component introduced in 0.96+, I haven’t been able to upgrade… I’ve taken a crack at adjusting the python component a bit myself, but unfortunately my python skills aren’t quite where they need to be, and I don’t fully understand the changes to the climate component.

Before I bang my head against the wall longer trying to figure out the modifications needed - have you by chance upgraded this component for 0.96+?

The latest code on GitHub should now be compatible with the climate changes introduced in 0.96+. I’m currently running it on 0.102.3. There is a small bug where sometimes the temperature will read -18C after a Home Assistant restart, but changing the thermostat temperature manually in Control4 seems to reset it.

Yes, the communication is 2-way, and will refresh as fast as the scan_interval: in the component configuration (in seconds).

Awesome, I’ll take a look and see if I can roll your changes in with mine. If i get time I’ll add a fork there too for the switch issue… I think what I did with the dimmer/non-dimmer switch could be easily controlled with an additional parameter, I just don’t have any C4 dimmers to test with.

Have you upgraded your C4 controller to 3.x+? Kind of holding off, afraid it will break the (unsupported) two way web driver.

My controller is OS 3.0 now, it works just fine for me.
If you could create a fork of my repository on GitHub with your changes that would be great! All my lights are dimmers so I would be able to test your lighting changes.

@coolTNT I was able to tweak this a bit and get it working with my setup as well, now running 103. The changes I made were related to support for temp range - which it looks like you had some code in place for but it was commented out. Would be great it we could make it fully work with range or single target.

Also, the variables you were pulling were for degrees C, not F - I’m going to build a switch in for that as well so either will work and play with the target temp vs range a bit and then i’ll upload it to github. Any particular reason you had the range/high/low values commented out?

For others working with Control4 Integration, found this little gem today… If you need to do more than what is exposed with the web driver referenced in this post (IE you want to trigger automations in Control4 beyond switching a light) try this.

https://untestedhacks.com/2013/web-events-driver/

You can call a string command in to the Controller, and then take action based on what the command was… very basic, but adds some ability to talk to Control4.

Strange, just install everything, i can control the light, but don’t see the brightness bar.

And I also get this error:
File “C:\Users\Administrateur.000\AppData\Roaming.homeassistant\custom_components\control4\light.py”, line 47, in async_setup_platform
yield from async_add_devices(
TypeError: ‘NoneType’ object is not iterable

@Gecko2308 I’ve been getting this since I installed it as well, but it doesn’t appear to be an issue, it just occurs at boot.

@coolTNT I just migrated to a new host for my HA instance and suddenly just climate is failing with this (very not helpful) error. Any ideas?

2020-02-14 19:58:27 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.thermostat fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
    await self.async_update()
  File "/config/custom_components/control4/climate.py", line 251, in async_update
    self._state = STATE_MAPPING[json_text[STATE_VARIABLE_ID]]
KeyError: ''

EDIT: Disregard - turns out that if the C4 thermostat is idle for a long period of time it returns an empty string for variable 1107. Changing the state mapping to this fixed the issue:

STATE_MAPPING = {
    "Off": CURRENT_HVAC_IDLE,
    "" : CURRENT_HVAC_IDLE,
    "Cool": CURRENT_HVAC_COOL,
    "Heat": CURRENT_HVAC_HEAT
}