LG Therma V heat pump modbus control

Hello,

I’m struggling to integrate my heat pump to homeassistant via modbus.
HA runs on a raspberry pi with a modbus to usb adapter connected.

I can read the registers fine and I can write to coils, but writing to registers is not working. maybe someone has any idea.
Here’s my configuration:
→ the sensors in my configuration.yaml work, this is an example:

modbus:
  - name: modbus_serial
    type: serial
    baudrate: 9600
    bytesize: 8
    method: rtu
    parity: N
    port: /dev/ttyUSB0
    stopbits: 1
    sensors:
      - name: DHW_target_temp
        scan_interval: 5
        address: 8
        slave: 1
        input_type: holding
        scale: 0.1
        device_class: temperature
        unit_of_measurement: '°C'

writing to coils also works:

switches:
      - name: Heizung
        slave: 1
        address: 0
        write_type: coil
        command_on: 1
        command_off: 0
        verify:
            input_type: coil
            address: 0
            state_on: 1
            state_off: 0

what doesn’t work is my automation to write the temperature setpoint (in automations.yaml):

- alias: Heizung Setpoint Update
  description: ''
  trigger:
    - platform: state
      entity_id: input_number.heizung_setpoint
  condition: []
  action:
    - service: modbus.write_register
      data_template:
        address: 2
        slave: 1
        hub: modbus_serial
        value_template: "{{ states('input_number.heizung_setpoint') | int * 10 }}"
        mode: single
        write_type: holding

here’s the relevant section from the heatpump manual (note: it’s a holding register even though it says input):

2 Likes

Hello Laserranger3000,

I would love to help you with this, but currently the HM.071 is being installed so not yet possible to test… or make also not yet an ModBus print in my machine, so my question for you is what Modbus print is installed in youre WP? there seem to be 4 types… (PMNFP14xx??)

My idea was to connect the ModBus Wires to an Wemos D1 wich receives/ask the Modbus in

I orderd this via Enri.nl
(githubhttps://github.com/aiolos/ESPHome-config for programm info…

My skills are more an combi of software/hardware, but programming knowledge backup is availble (via Son :slight_smile:

I hope to have fixed this with 1 month…(mostly depending on the Modbus interface (PMNFP14A1 or else…)

Kind regards Peter Nibbixwoud (Holland)

Hello,

I’m not sure if this is any help, but have you seen this blog which points out some errors in the manual relating to Modbus: Therma V – Modbus information – YourWizBlog

Mark

Hello Peter,

I would like to know if you have already managed to set up the integration with the HP. I already have an RS485 to USB connection. but there I get a “Cleanup recv buffer before send:” error.
So I was wondering if your setup works?

Kind regards Nick Opperdoes (Holland)

1 Like

Hello,

I managed to get it working with lots of trial and error and the climates integration, here’s my configuration.yaml
I hope it helps someone :slight_smile:

modbus:
  - name: modbus_serial
    type: serial
    baudrate: 9600
    bytesize: 8
    method: rtu
    parity: N
    port: /dev/ttyUSB0
    stopbits: 1
    sensors:
    
      - name: "wp_outlet_temp"
        scan_interval: 10
        address: 3
        slave: 1
        input_type: input
        scale: 0.1
        device_class: temperature
        unit_of_measurement: '°C'
        
      - name: "flow_rate"
        scan_interval: 10
        address: 8
        slave: 1
        input_type: input
        scale: 0.1
        unit_of_measurement: 'l/min'
        
      - name: "outside_temp"
        scan_interval: 10
        address: 12
        slave: 1
        input_type: input
        scale: 0.1
        device_class: temperature
        unit_of_measurement: '°C'


    switches:
    
      - name: "Heizung"
        slave: 1
        address: 0
        write_type: coil
        command_on: 1
        command_off: 0
        verify:
            input_type: coil
            address: 0
            state_on: 1
            state_off: 0
            
      - name: "Warmwasser"
        slave: 1
        address: 1
        write_type: coil
        command_on: 1
        command_off: 0
        verify:
            input_type: coil
            address: 1
            state_on: 1
            state_off: 0
            
      - name: "Silent Modus"
        slave: 1
        address: 2
        write_type: coil
        command_on: 1
        command_off: 0
        verify:
            input_type: coil
            address: 2
            state_on: 1
            state_off: 0
            
    climates:
      - name: "lg_therma_heizung"
        address: 3
        slave: 1
        input_type: input
        count: 1
        #data_type: custom
        max_temp: 45
        min_temp: 15
        offset: 0
        precision: 0
        scale: 0.1
        #structure: ">f"
        target_temp_register: 2
        temp_step: 1
        temperature_unit: C
        hvac_mode_register:
          address: 0
          values:
            state_cool: 0
            state_heat: 4
            
      - name: "lg_therma_warmwasser"
        address: 5
        slave: 1
        input_type: input
        count: 1
        #data_type: custom
        max_temp: 57
        min_temp: 40
        offset: 0
        precision: 0
        scale: 0.1
        #structure: ">f"
        target_temp_register: 8
        temp_step: 1
        temperature_unit: C

The only bug that’s still unresolved is this behaviour:
image

For now it’s low priority for me since it doesn’t affect the functionality, but eventually I would like to fix it. Unfortunately I don’t see a way to add a dummy sensor for that, because the climate integration directly accesses the modbus registers, and there’s no obvious way to use a “normal” sensor instead.

1 Like

Ha die Nick Opperdoes, Opperdoes??? Das om de hoek :slight_smile:

Yes I finally found the "bug/… Not only dip switch 1 has to be set also number 2… found out by trial and error… :-\ It says Modbus on/off switch 1 , and dedicatd or genral on dipswitch 2 … the seem to be reserve explained in the PDF… now bugging with al the possibilities… … but something with time…
I will upload part of the pdf and print later!

where do you get the modbus addresses you used? on the Therma V manual they are the ones in the screen shot you posted. I’ve tried using your logs but I’m only getting the 12 in the outside temperature recognized. The others don’t work.

All of the values are stated in the manual.
→ You have to substract 1 of the addresses in the manual for HA
→ holding and input registers are swapped in the manual

did you copy-paste my config directly?

hey peter, yes ik woon om de hoek kom een keer een bakkie doen.
I found out something als with the trail and error.i had to set dip 1 to on (slave) in the the SW2 and also on the SW1. only then it started sending the information back over the modbus. this worked for me for 3 weeks after that it stopt working. although i did not change anything.
when i use the same dip swith settings as you did i get errors.

Hi, I copied your code, I also tried the numbers 0 to 27 as input and it gives me different values ​​that I can’t decipher. The switches don’t work and as sensors I can only read two exact temperatures, which update correctly. What you read from the heat pump display. Can you help me solve the problem? I need to turn the heat and hot water on and off and change the target temperatures. Thank you

did you set the dip switches in the heat pump correctly?
which modbus usb dongle are you using?

The dip switches for the modbus in correctly set: SW1: dip1 ON, SW2: dip 1 ON. The dongle is yulianrui adapter convertitore usb rs485/422. I tried entering the input registers from 0 to 30 and it gives me values ​​for the registers from 9 to 27. I observed the behavior of the pump from the display and of all the values ​​only 2 correspond: the hot water temperature and the temperature in exit.

  • name: “wp_outlet_temp16”
    scan_interval: 10
    address: 16
    slave: 1
    input_type: input
    scale: 0.1
    device_class: temperature
    unit_of_measurement: ‘°C’
  • name: “wp_outlet_temp24”
    scan_interval: 10
    address: 24
    slave: 1
    input_type: input
    scale: 0.1
    device_class: temperature
    unit_of_measurement: ‘°C’
    the switches and climate controls do not control the heat pump. what can I do? can you help me to solve the problem?

Hoi Peter,
Could you help me…I have a Therma V 9 kW heatpump and want to use the modbus for monitoring and operation of some functions of the HP.

Which hardware do I need exactly and which software?

I am running ESP already for my Dallas temp sensors and Tasmota for my smart switches.

Thanks in advance for the help!
Best regards from Hans in Veenendaal

LET OP hij moet dus MODBUS ondersteunen, ik had eerst de verkeerd :frowning:
kost ff meer waarschijnlijk, en er is waarschijnlijk nog een goedkoper alternatief, maar deze werkt…
(na een hoop geklooi met een Wemos D1…

uren en avonden klooien verder had ik opeens beeld en geluid :slightly_smiling_face:
in de PDF van de LG die ik had staat dan 0004 maar dat is dan adres 3… *duh…)
toen nog een tijdje fine tunnen en nu werkt het naar behoren

take the one that support modbus


probably costs more, and there is probably another cheaper alternative, but this one works…
(after a lot of fiddling with a Wemos D1…
hours and evenings of messing around I suddenly had image and sound :slightly_smiling_face:
in the PDF of the LG that I had it says 0004 but that is address 3… *duh…)

some fine-tunning afterwards and it works wel

code in configuration.yaml

modbus:

  • name: “hub1”

    close_comm_on_error: true

    delay: 1

    timeout: 1

    retries: 5

    retry_on_empty: true

    message_wait_milliseconds: 200

    host: 192.168.xxx.xxx <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< eigen IP invullen uiteraard

    port: 502

    type: tcp

    binary_sensors:

    • name: wwp_10001_Status Waterstroming

      slave: 7

      address: 0

      device_class: running

      input_type: discrete_input

      scan_interval: 10

    • name: wwp_10002_Status Waterpomp

      slave: 7

      address: 1

      device_class: running

      input_type: discrete_input

      scan_interval: 10

    • name: wwp_10003_Status Waterpomp Extern

      slave: 7

      address: 2

      device_class: running

      input_type: discrete_input

      scan_interval: 10

    • name: wwp_10004_Status Compressor

      slave: 7

      address: 3

      device_class: running

      input_type: discrete_input

      scan_interval: 10

    • name: wwp_10005_Status Ontdooien

      slave: 7

      address: 4

      device_class: running

      input_type: discrete_input

      scan_interval: 10

    • name: wwp_10008_Status Stiltemodus

      slave: 7

      address: 7

      device_class: running

      input_type: discrete_input

      scan_interval: 10

    sensors:

    • name: wwp_30003_invoer_temp

      scan_interval: 10

      slave: 7

      address: 2

      input_type: input

      scale: 0.1

      device_class: temperature

      unit_of_measurement: °C

    • name: wwp_30004_uitvoer_temp

      scan_interval: 10

      slave: 7

      address: 3

      input_type: input

      scale: 0.1

      device_class: temperature

      unit_of_measurement: °C

    • name: wwp_30008_kamerlucht_temp

      scan_interval: 10

      slave: 7

      address: 7

      input_type: input

      scale: 0.1

      device_class: temperature

      unit_of_measurement: °C

    • name: wwp_30013_buitenluchttemp

      scan_interval: 10

      slave: 7

      address: 12

      input_type: input

      scale: 0.1

      device_class: temperature

      unit_of_measurement: °C

    switches:

    • name: wwp_00001_wp_aan_uit

      slave: 7

      address: 0

      write_type: coil

      command_on: 1

      command_off: 0

      verify:

      input_type: coil

      address: 0

      state_on: 1

      state_off: 0

    • name: wwp_00003_stilte_modus

      slave: 7

      address: 2

      write_type: coil

      command_on: 1

      command_off: 0

      verify:

      input_type: coil

      address: 2

      state_on: 1

      state_off: 0

    climates:

    • name: wwp_40003_doel_temperatuur

      slave: 7

      address: 2

      input_type: input

      count: 1

      max_temp: 65

      min_temp: 20

      offset: 0

      precision: 0

      scale: 0.1

      target_temp_register: 2

      temp_step: 5

      temperature_unit: C

      hvac_mode_register:

      address: 0

      values:

      state_cool: 0
      
      state_heat: 4
      



Hello, I have the LG HM161M U33 heat pump.

I am unable to connect and communicate through Modbus. Could someone verify If I do the correct steps:

Set SW1 to the below slot

Connect to the below terminal for Modbus

Should I also change the SW2 to slave option? I am not sure if I did this step.

Hello I was trying same also.
You need to change SW1 Dip1 : ON and SW1 Dip2 : ON
It worked for me

Ps. Also I needed change Modbus adres from 1 to 2. When adress was 1 it didnt work for me.

Thank you.

And something else, the registers that can be used to control the heap pump, are the Input Registers (0x04) and Coil Registers (0x01), right?

Graziano77: Did you manage issue? I also have access to some registers/coils only! I cannot find way to solve it!lg therma

@Delisaber

I tried what you said but no results.

The heat pumps keeps ignoring my read commands

just for Others: I have chcecked with LG. they said modbus is not supported for all heating pumps like NK3(Therma V) which I have. for me they have software bug when modbus works for some registers only, there is also full configuration in service manual… due to fact only some people do integration for modbus… i think they did ignore this issue…