Controlling LG Heat Pumps in Home Assistant

2017-07-12 in Home Automation HomeAssistant

I have two LG heat pumps that I use for heating and cooling in the house. These are mini-splits that operate only with a remote and do not have a centralized thermostat that I can easily replace. It doesn’t help that the device itself is pretty bad at working at maintaining a temperature instead of just always blasting out air at a single temperature. I originally tried the Z-wave ZXT-120 IR Extender with SmartThings but had many issues getting it to reliably control the unit. I wanted something anyway that I could extend to other devices near by that also used IR if needed anyway.

The solution so far has been the Broadlink RM pro which does both IR and RF remote control emulation. Home Assistant has a Broadlink component that allows you to directly control IR/RF actions as a switch.

The biggest complaint/issue is how you need to get the IR/RF codes. The easiest way I found was to learn them directly from the remote using the Broadlink app in Android and then following the instructions on the Broadlink component page under ‘Using E-Control Remotes’ sections.

Here is my configuration for Home Assistant with a switch for cooling and heating at predetermined settings.

switch:
  - platform: broadlink
    host: 123.123.123.123
    mac: '00:00:00:00:00:00'
    switches:
      heatpump_cool:
        friendly_name: "Heatpump Cooling"
        command_on: 'JgBAAAABJIkRNBIPEhIPFA42DhQOFQ8SEBMQExATDhQOFA8UDhQPFA4TDzYPFA42DxIQNg4TEBMPNQ8UDxMJPA0ADQUAAAAAAAAAAA=='
        command_off: 'JgBAAAABJIkQNRESDxMQEBMzEREQEw8TDzURMxEREREQExASEBIQEw8TEBMQEhASEBMQNBERETQQEhEREBMQNBEADQUAAAAAAAAAAA=='
      heatpump_heat:
        friendly_name: "Heatpump Heating"
        command_on: 'JgBAAAABI4oQNQ8TEBIQEg81EBMPEw8TEBMPEw8UEBIPFA81EBMPExASDzUQEhASEBIREg81EBIQNRASEDQQEw8ADQUAAAAAAAAAAA=='
        command_off: 'JgBAAAABJIkQNRESDxMQEBMzEREQEw8TDzURMxEREREQExASEBIQEw8TEBMQEhASEBMQNBERETQQEhEREBMQNBEADQUAAAAAAAAAAA=='

As you can see this is somewhat limiting as there is really only binary choices on heating and cooling and not at particular temperatures. The LG heat pumps I have have remotes that have displays so they have to send the entire configuration state in a large chunk of IR data each time and the individual controls are not easily exposed. I can go back and choose a few different options if need be but for now this works pretty well as I really just need the heat pumps to spit out hot or cold air like any other furnace.

To wrap this up in a way that makes automation simple I setup a generic thermostat in Home Assistant like so:

climate:
  - platform: generic_thermostat
    name: 'Main Floor'
    heater: switch.heatpump_cooling
    target_sensor: sensor.living_room_temperature
    ac_mode: true
    target_temp: 22
    tolerance: 1.0
    min_cycle_duration:
      seconds: 120

Right now the ‘ac_mode’ is hard coded in the configuration but I need to look into ways to automate switching this at different times. There is also no way to really turn off a generic thermostat right now in Home Assistant so an automation is used to set the target temperature very high (or low if ac_mode is off in the winter) to stop any actions.

automation:
  - alias: "Disable Thermostats at Night"
    trigger:
      platform: time
      at: "20:00:00"
    action:
      service: climate.set_temperature
      data:
        entity_id: climate.main_floor
        temperature: 32

  - alias: "Enable Thermostats in Morning"
    trigger:
      platform: time
      at: "07:30:00"
    action:
      service: climate.set_temperature
      data:
        entity_id: climate.main_floor
        temperature: 22

Obviously this is not perfect and a more precise IR control method would be preferred but this get the job done and has drastically reduced the power usage from the heat pumps in the summer.