How do I config modbus tcp for Nibe S1255?

Thanks I will add the other sensors once I figure out the unique ID issue. Did you use the lovelace entities card to get your readings?

Got it working!!!

Has anyone been able to write to the heat pump?
I found out that there are not to many registers you can write to.

1 Like

I have managed to enable “More hot water” through the following code.

switches:
- name: “Nibe - Extra Varmvatten”
write_type: holding # R/W
address: 697
slave: 1
command_on: 3
command_off: 0


Off=0
One time increase =2
3h=3
6h=6
12h=12
24h=24
48 hours = 48

4 Likes

Nice Ola,

Did you add this to the “nibe” yaml file? Can you post a screenshot of your gui?

Which model heat pump? I can seem to find the 697 address in my list.

In my yaml-file
image

Nibe S1255-16

5 Likes

Awesome it also works with Nibe VVM S320!

The only thing that is now missing is to Set goal temperature of room sensor.

Cool, thanks for sharing!
Has anyone managed to write/control the electric booster heater (for warm water)?
I can read it but I‘d like to control it in relation with my PV to heat water mostly when PV is generating enough electricity. I know the sg-ready can take care of this but I‘d like HA to control the logic and write to the Nibe via modbus

Dear Ola,

I copied the switch setting and modified my nibe yaml to include the top part.

Got and error on reboot:

2022-09-08 14:55:49.907 ERROR (MainThread) [homeassistant.config] Unknown error calling modbus CONFIG_SCHEMA

File “/usr/src/homeassistant/homeassistant/components/modbus/validators.py”, line 224, in duplicate_modbus_validator

2022-09-08 14:55:49.926 ERROR (MainThread) [homeassistant.setup] Setup failed for modbus: Invalid config.

modbus:
  type: tcp
  host: 192.168.88.220
  port: 502
  name: "Nibe"
  delay: 10
  
  # Close_comm_on _error: true
  retry_on_empty: true
  retries: 3
  timeout: 15
  message_wait_milliseconds: 500

line 224 is the scan part:

    unique_id: "hotwater_top_BT7"
    device_class: temperature
    state_class: measurement
    unit_of_measurement: "°C"
    data_type: int16
    address: 8
    count: 1
    slave: 1
    precision: 1
    input_type: input
    scale: 0.1
    scan_interval: 30

Any ideas?

Have you tried writing exactly like me with spaces at the beginning of the lines?
You seem to have a different code, in mine there is no scan.

Yes, but it doesn’t like the “modbus part” of the code.

modbus:
  type: tcp
  host: 192.168.88.220
  port: 502
  name: "Nibe"
  delay: 10
  
  # Close_comm_on _error: true
  retry_on_empty: true
  retries: 3
  timeout: 15
  message_wait_milliseconds: 500

Ok I got it working with my original configuration! Great!!!

  type: tcp
  host: 192.168.88.220
  port: 502
  name: "Nibe"
  
  sensors:
# Switches

  switches:
  - name: "More Hot Water"
    unique_id: "More Hot Water"
    write_type: holding # R/W
    address: 697
    slave: 1
    command_on: 3
    command_off: 0

I removed the scan intervals from the other entries and added the “unique id”

Works well!

Now we need to find others like Hot Water Demand, Heating Curve Offset and Operating Mode!

1 Like

Any one got other registers they can write to?

1 Like

Thanks guys!
Works great with my S320.

I tested other address, such as 56 for “Hot Water Demand” and it works great.

2 Likes

Heating curve, climate system 1
address: 26
values: from 0 - 15

Heating curve offset, climate system 1
address: 30
values: from -10 - +10

But I don’t know how to increse or decrese the value of these registers with a switches

2 Likes

Thanks Sebastian,

I have the registers and can read them, but creating a switch is what I am looking for.

this is what my set up looks like. Would like to be able to manage the offset and operating mode.

Then i will be happy :grinning_face_with_smiling_eyes:

1 Like

This looks great! Would you mind sharing your entire config for the modbus setup accessing your Nibe?

Sure, keep in mind this is for the S1225.

  type: tcp
  host: 192.168.XXX.XXX #your ip goes here
  port: XXX #your port number
  name: "Nibe"
  
  sensors:

# Overview

  - name: "Heatpump - Power Usage"
    unique_id: "power_usage"
    unit_of_measurement: "W"
    data_type: int16
    device_class: power
    address: 2166
    input_type: input
    scale: 1
    precision: 0
    slave: 1

  - name: "Heatpump - Priority"
    unique_id: "operating_prioritisation"
    data_type: int16  # int8
    # 10: Off, 20: Hot Water, 30: Heat, 40: Pool, 60: Cooling
    address: 1028
    input_type: input  # R/W
    scale: 1
    precision: 0
    state_class: measurement
    slave: 1

  - name: "Heatpump - Operating Mode"  
    # 0: auto, 1: manual, 2: additional heating only
    unique_id: "operating_mode"
    data_type: int16  # uint8
    address: 237
    input_type: holding # R/W
    scale: 1
    precision: 0
    state_class: measurement
    slave: 1


  - name: "Heatpump - Heating Curve Offset"  # 1.30.1
    unique_id: "heating_curve_offset"
    data_type: int16  # int8
    address: 30
    input_type: holding # R/W
    scale: 1
    precision: 0
    state_class: measurement
    slave: 1


  - name: "Heatpump - Supply Temp Min"  
    unique_id: "supply_temperature_min"
    unit_of_measurement: "°C"
    data_type: int16  # int8
    device_class: temperature
    address: 34
    input_type: holding
    scale: 0.1
    precision: 1
    state_class: measurement
    slave: 1


  - name: "Heatpump - Supply Temp Max"  
    unique_id: "supply_temperature_max"
    unit_of_measurement: "°C"
    data_type: int16  # int8
    device_class: temperature
    address: 38
    input_type: holding
    scale: 0.1
    precision: 1
    state_class: measurement
    slave: 1


# Heating

  - name: "Heatpump - Calculated Supply (Heating)"
    unique_id: "calculated_supply_heating"
    unit_of_measurement: "°C"
    data_type: int16
    device_class: temperature
    address: 1017
    input_type: input  # R
    scale: 0.1
    precision: 1
    state_class: measurement
    slave: 1

  - name: "Heatpump - Supply Line (BT2)"
    unique_id: "supply_line_BT2"
    device_class: temperature
    state_class: measurement
    unit_of_measurement: "°C"
    data_type: int16
    address: 5
    count: 1
    slave: 1
    precision: 1
    input_type: input
    scale: 0.1


  - name: "Heatpump - Return Line (BT3)"
    unique_id: "return_line_BT3"
    device_class: temperature
    state_class: measurement
    unit_of_measurement: "°C"
    data_type: int16
    address: 7
    count: 1
    slave: 1
    precision: 1
    input_type: input
    scale: 0.1


  - name: "Heatpump - Outdoor Temperature (BT1)"
    unique_id: "outdoor_temperature_BT1"
    device_class: temperature
    state_class: measurement
    unit_of_measurement: "°C"
    data_type: int16
    address: 1
    count: 1
    slave: 1
    precision: 1
    input_type: input
    scale: 0.1


  - name: "Heatpump - Average Temperature (BT1)"
    unique_id: "average_temp_heatpump_BT1"
    device_class: temperature
    state_class: measurement
    unit_of_measurement: "°C"
    data_type: int16
    address: 37
    count: 1
    slave: 1
    precision: 1
    input_type: input
    scale: 0.1


  - name: "Heatpump - Condenser Supply (BT12)"
    unique_id: "condenser_supply_bt12"
    unit_of_measurement: "°C"
    data_type: int16
    device_class: temperature
    address: 12
    input_type: input  # R
    scale: 0.1
    precision: 1
    state_class: measurement
    slave: 1

  - name: "Heatpump - Brine In (BT10)"
    unique_id: "brine_in_BT10"
    device_class: temperature
    state_class: measurement
    unit_of_measurement: "°C"
    data_type: int16
    address: 10
    count: 1
    slave: 1
    precision: 1
    input_type: input
    scale: 0.1


  - name: "Heatpump - Brine Out (BT11)"
    unique_id: "brine_out_BT11"
    device_class: temperature
    state_class: measurement
    unit_of_measurement: "°C"
    data_type: int16
    address: 11
    count: 1
    slave: 1
    precision: 1
    input_type: input
    scale: 0.1


# Hot Water

  - name: "Heatpump - Hot Water Demand"
    unique_id: "hot_water_demand"
    data_type: int16 
    # 0: Small, 1: Medium, 2: Large, 4: Smart Control
    address: 56
    input_type: holding  # R/W
    scale: 1
    precision: 0
    state_class: measurement
    slave: 1

  - name: "Heatpump - Hot Water Top (BT7)"
    unique_id: "hotwater_top_BT7"
    device_class: temperature
    state_class: measurement
    unit_of_measurement: "°C"
    data_type: int16
    address: 8
    count: 1
    slave: 1
    precision: 1
    input_type: input
    scale: 0.1


  - name: "Heatpump - Hot Water Charging (BT6)"
    unique_id: "hotwater_charging_BT6"
    device_class: temperature
    state_class: measurement
    unit_of_measurement: "°C"
    data_type: int16
    address: 9
    count: 1
    slave: 1
    precision: 1
    input_type: input
    scale: 0.1


  - name: "Heatpump - Compressor Status"
    unique_id: "compressor_status"
    data_type: int16  # uint8
    # 0: Off, 1: On (Operate)
    address: 1100
    input_type: input  # R
    scale: 1
    precision: 0
    state_class: measurement
    slave: 1

# Switches

  switches:
  - name: "More Hot Water"
    unique_id: "More Hot Water"
    write_type: holding # R/W
    address: 697
    slave: 1
    command_on: 3
    command_off: 0 
  

So I created a separate yaml file called “nibe”. There are more registers but I haven’t included them. Technically the registers that have #R/W are writable. Haven’t figured out how yet! :thinking:

2 Likes

Thanks for sharing - yeah I‘m also still trying to find out how to write to the registers. I‘ve successfully added the one to request more hot water, habe you figured out though how to not only use it as a switch in HA but also keep it updated when the heatpump sets it back?

I was thinking of a polling of the actual state somehow but I don’t know how realize it yet…

No I have it as a switch. It turns changes colour when on and I guess when it it goes off it changes back to grey. But I programmed that in my mushroom card