Modbus tcp connection to NIBE S1255

Hope I posted this in the right category…
I’m trying to connect to my new heat pump NIBE S1255 via modbus tcp.
But I’m not getting any data to the entities.
The 2 parts to add in my configuration.yaml is:

modbus:
  type: tcp
  host: 192.168.1.186
  port: 502
  name: Nibe

and then the sensors, and here is where I can´t find any information to check if I’m doing it right.

Sensor:
  - platform: modbus
    scan_interval: 10
    registers:
      - name: "Varmvatten"
        hub: Nibe
        unit_of_measurement: °C
        register: 8
        count: 1
        precision: 1

I found information in this pdf, https://proffs.nibe.se/upload/NEW/Support/Kommunikation/Modbus%20S-modellerna%20hemsida%202038-3.pdf
But Im not sure how to interpret the values there.
Anyone that can help me with this?

1 Like

Really no one who works with modbus has any comment on this? Tips or anything else that might be helpful?

Jag testade först med EasyModbusClient innan jag fick igång med modbus till min Heru FTX.
Det finns en bra exempel åt annars är det grekiska att förstå det.

  • Read Coils (FC1)
  • Read Discrete Inputs (FC2)
  • Read Holding Registers (FC3)
  • Read Input Registers (FC4)
  • Write Single Coil (FC5)
  • Write Single Register (FC6)
  • Write Multiple Coils (FC15)
  • Write Multiple Registers (FC16)
1 Like

Tack @JLeandroFreitas! Du menar att jag ska testa från windowsprogrammet först för att komma fram till rätt inställningar och parametrar?
Har kört lite tester och får fram data via EasyModbus från FC4-registret på min NIBE.
Kan ju konstatera då att mitt problem ligger i HA-konfigurationen.
Får denna information från Core-loggfilen i HA:

2021-02-02 15:50:40 ERROR (SyncWorker_3) [pymodbus.client.sync] Connection to (192.168.1.186, 502) failed: timed out
2021-02-02 15:50:50 ERROR (SyncWorker_7) [pymodbus.client.sync] Connection to (192.168.1.186, 502) failed: timed out
2021-02-02 15:51:00 ERROR (SyncWorker_4) [pymodbus.client.sync] Connection to (192.168.1.186, 502) failed: timed out

Verkar som HA inte kan kommunicera med NIBE.
@JLeandroFreitas kan du dela din HA-konfiguration så jag kan se ifall jag missat något?

@Henke71 did you get any further with this? I am able to get it to connect to the S1255, I have tried a few register numbers, but don’t appear to be getting any correct readings back.

@timpea, no I didn´t, stuck on the error messages from HA. But I can communicate and get information via windows EasyModbus. So I assume the problem is within HA.
If you can communicate with S1255 from HA, can you share the code in your configuration and sensor yaml?

@Henke71 See below, the BT6 currently isn’t returning anything. The others I have entered are all working. I don’t have a Windows computer to try the Nibe Modbus Manager, I believe you can get a list of the register id’s off it.

# Modbus 
modbus:
  name: Nibe
  type: tcp
  host: 192.168.8.50
  port: 502
sensor:
  - platform: modbus
    registers:
    - name: Return Temp BT3
      hub: Nibe
      unit_of_measurement: °C
      slave: 1
      register: 7
      scale: 0.1
      precision: 1
      register_type: input
    - name: Hot Water Charging BT6
      hub: Nibe
      unit_of_measurement: °C
      slave: 1
      register: 9
      scale: 0.1
      precision: 1
      register_type: input
    - name: Brine In BT10
      hub: Nibe
      unit_of_measurement: °C
      slave: 1
      register: 10
      scale: 0.1
      precision: 1
      register_type: input
    - name: Brine Out BT11
      hub: Nibe
      unit_of_measurement: °C
      slave: 1
      register: 11
      scale: 0.1
      precision: 1
      register_type: input
    - name: Outside Temp BT1
      hub: Nibe
      unit_of_measurement: °C
      slave: 1
      register: 37
      scale: 0.1
      precision: 1
      register_type: input
      

I have the same configuration in the yamls so I can assume that the problem is somewhere else. Still get the errors in the Core log:
2021-03-13 11:16:37 ERROR (SyncWorker_3) [pymodbus.client.sync] Connection to (192.168.1.186, 502) failed: timed out
Do you get any other text in the core log file?

Strange, If you can connect with ModBus manager, I would guess there is a network issue between Home Assistant and the heat pump. Have you tried pinging the GSHP IP from the Home Assistant computer?

I will also try connecting my S1155 via Modbus. Does anyone here have a setup of sensors they can share to make it a bit easier to start? Or is this information already available somewhere? :slight_smile:

I’m using the Modbus over TCP as well for my HA to S1155 connection.
All registers seems to work, although I’m still looking for the holding register with which I can modify the room temperature.

I’m using a RMU S40 for this, but nowhere in the documentation I can find the register for this.
Documentation used for all registers: https://partner.nibe.eu/nibedocuments/29795/M12676EN-1.pdf.

Also did an export of all registers from the S1155 itself (via USB), but found nothing that worked.
Anyone of you got this working?

2 Likes

I’ll be installing my S1155 and Weinzierl KNX gateway shortly and hope to achieve the same. There will be KNX temperature sensors in the rooms so would be nice to skip the Nibe thermostats and feed in the current temperature over the Modbus interface.

See here and here for the RMU S40 temperature register.

Both @jwpas and myself contacted Nibe support about this.

However still no humidity sensor or the write register to set the temperature on the RMU S40.

I have used this configuration that you posted and restarted HA. But i can’t get any sensors in my inventory at all. I have the Nibe S1255 and i can connect to it via the EasyModbus like Henke71
the homeassistant server and the S1255 is in the same subnet so no firewall or things like that in between.

Here is how I checked if the pump responds to modbus using https://github.com/favalex/modbus-cli

Installing modbus-cli

git clone [email protected]:favalex/modbus-cli.git
python3 -m venv .env
source .env/bin/activate
pip install modbus_cli

Getting modbus addresses from https://proffs.nibe.se/upload/NEW/Support/Kommunikation/M12676SV.pdf

Note that for me the following addresses are not included since they’re not working, probably due to the features missing or not being used 8, 39, 1319.

Calling pump using modbus-cli with the addresses above

modbus 192.168.x.y i@1/h -v
modbus 192.168.x.y i@5/h -v
modbus 192.168.x.y i@7/h -v
modbus 192.168.x.y i@9/h -v
modbus 192.168.x.y i@10/h -v
modbus 192.168.x.y i@11/h -v
modbus 192.168.x.y i@12/h -v
modbus 192.168.x.y i@13/h -v
modbus 192.168.x.y i@14/h -v
modbus 192.168.x.y i@16/h -v
modbus 192.168.x.y i@26/h -v
modbus 192.168.x.y i@86/h -v
modbus 192.168.x.y i@1102/h -v
modbus 192.168.x.y i@853/h -v
modbus 192.168.x.y i@218/h -v
modbus 192.168.x.y i@1046/h -v
modbus 192.168.x.y i@1083/h -v
modbus 192.168.x.y i@1100/h -v
modbus 192.168.x.y i@1104/h -v
modbus 192.168.x.y i@222/h -v

Optionally you should be able to use an input file like below

$ sudo nano registers.modbus

nibe_utetemperatur_BT1 i@1/h
nibe_framledningstemperatur_BT2 i@5/h
nibe_returledningstemperatur_BT3 i@7/h
nibe_varmvatten_laddning_BT6 i@9/h
nibe_koldbarare_in_BT10 i@10/h
nibe_koldbarare_ut_BT11 i@11/h
nibe_kondensor_fram_BT12 i@12/h
nibe_hetgas_BT14 i@13/h
nibe_vatskeledning_BT15 i@14/h
nibe_suggas_BT17 i@16/h
nibe_rumstemperatur_1_BT50 i@26/h
nibe_kompressorgivare_EB100_BT29 i@86/h
nibe_varmebararpumphastighet_GP1 i@1102/h
nibe_driftlage_varmebararpump i@853/h
nibe_varmebararpumphastighet_GP1_Manuell i@218/h
nibe_aktuell_kompressorfrekvens i@1046/h
nibe_kompressorstarter i@1083/h
nibe_kompressor_status i@1100/h
nibe_koldbararpumphastighet_GP2  i@1104/h
nibe_koldbararpumphastighet_GP2_Manuell i@222/h

Using the file above

 modbus -r registers.modbus 192.168.x.y nibe\*

The other registers return just fine as per the output below.

(.env) pi@raspberrypi:~/Documents $ modbus -r registers.modbus 192.168.x.y nibe\*
Parsed 20 registers definitions from 2 files
nibe_utetemperatur_BT1: 51 0x33
nibe_framledningstemperatur_BT2: 460 0x1cc
nibe_returledningstemperatur_BT3: 303 0x12f
nibe_varmvatten_laddning_BT6: 420 0x1a4
nibe_koldbarare_in_BT10: 52 0x34
nibe_koldbarare_ut_BT11: 26 0x1a
nibe_kondensor_fram_BT12: 355 0x163
nibe_hetgas_BT14: 790 0x316
nibe_vatskeledning_BT15: 336 0x150
nibe_suggas_BT17: 88 0x58
nibe_rumstemperatur_1_BT50: 229 0xe5
nibe_kompressorgivare_EB100_BT29: -32768 -0x8000
nibe_varmebararpumphastighet_GP1_Manuell: 0 0x0
nibe_koldbararpumphastighet_GP2_Manuell: 0 0x0
nibe_driftlage_varmebararpump: 0 0x0
nibe_aktuell_kompressorfrekvens: 270 0x10e
nibe_kompressorstarter: 493 0x1ed
nibe_kompressor_status: 1 0x1
nibe_varmebararpumphastighet_GP1: 100 0x64
nibe_koldbararpumphastighet_GP2: 41 0x29

I have tried translating this all into home assistant modbus which to me should be something like

modbus:
  type: tcp
  host: 192.168.x.y
  port: 502
  name: "Nibe"
  delay: 10
  #close_comm_on_error: true
  retry_on_empty: true
  retries: 3
  timeout: 15
  message_wait_milliseconds: 500
  sensors:
    - name: "Nibe - Utetemperatur (BT1)"
      unit_of_measurement: "°C"
      data_type: int16
      device_class: temperature
      address: 1
      input_type: input
      scale: 0.1
      precision: 1
      state_class: measurement
    - name: "Nibe - Framledningstemperatur (BT2)"
      unit_of_measurement: "°C"
      data_type: int16
      device_class: temperature
      address: 5
      input_type: input
      scale: 0.1
      precision: 1
      state_class: measurement
    - name: "Nibe - Returledningstemperatur (BT3)"
      unit_of_measurement: "°C"
      data_type: int16
      device_class: temperature
      address: 7
      input_type: input
      scale: 0.1
      precision: 1
      state_class: measurement
    #- name: "Nibe - Varmvatten topp (BT7)"
    #  unit_of_measurement: "°C"
    #  data_type: int16
    #  device_class: temperature
    #  address: 8
    #  input_type: input
    #  scale: 0.1
    #  precision: 1
    #  state_class: measurement
    - name: "Nibe - Varmvatten laddning (BT6)"
      unit_of_measurement: "°C"
      data_type: int16
      device_class: temperature
      address: 9
      input_type: input
      scale: 0.1
      precision: 1
      state_class: measurement
    - name: "Nibe - Köldbärare in (BT10)"
      unit_of_measurement: "°C"
      data_type: int16
      device_class: temperature
      address: 10
      input_type: input
      scale: 0.1
      precision: 1
      state_class: measurement
    - name: "Nibe - Köldbärare ut (BT11)"
      unit_of_measurement: "°C"
      data_type: int16
      device_class: temperature
      address: 11
      input_type: input
      scale: 0.1
      precision: 1
      state_class: measurement
    - name: "Nibe - Kondensor fram (BT12)"
      unit_of_measurement: "°C"
      data_type: int16
      device_class: temperature
      address: 12
      input_type: input
      scale: 0.1
      precision: 1
      state_class: measurement
    - name: "Nibe - Hetgas (BT14)"
      unit_of_measurement: "°C"
      data_type: int16
      device_class: temperature
      address: 13
      input_type: input
      scale: 0.1
      precision: 1
      state_class: measurement
    - name: "Nibe - Vätskeledning (BT15)"
      unit_of_measurement: "°C"
      data_type: int16
      device_class: temperature
      address: 14
      input_type: input
      scale: 0.1
      precision: 1
      state_class: measurement
    - name: "Nibe - Suggas (BT17)"
      unit_of_measurement: "°C"
      data_type: int16
      device_class: temperature
      address: 16
      input_type: input
      scale: 0.1
      precision: 1
      state_class: measurement
    - name: "Nibe - Rumstemperatur 1 (BT50)"
      unit_of_measurement: "°C"
      data_type: int16
      device_class: temperature
      address: 26
      input_type: input
      scale: 0.1
      precision: 1
      state_class: measurement
    #- name: "Nibe - Extern Framledning (BT25)"
    #  unit_of_measurement: "°C"
    #  data_type: int16
    #  device_class: temperature
    #  address: 39
    #  input_type: input
    #  scale: 0.1
    #  precision: 1
    #  state_class: measurement
    - name: "Nibe - Kompressorgivare (EB100-BT29)"
      unit_of_measurement: "°C"
      data_type: int16
      address: 86
      input_type: input
      scale: 0.1
      precision: 1
      state_class: measurement
    - name: "Nibe - Värmebärarpumphastighet (GP1)"
      unit_of_measurement: "%"
      data_type: int16
      device_class: temperature
      address: 1102
      input_type: input
      scale: 0.1
      precision: 1
      state_class: measurement
    - name: "Nibe - Värmebärarpumphastighet Manuell (GP1)"
      unit_of_measurement: "%"
      data_type: int16
      device_class: power_factor
      address: 218
      input_type: input
      scale: 1
      precision: 1
      state_class: measurement
    - name: "Nibe - Aktuell kompressorfrekvens"
      unit_of_measurement: "Hz"
      data_type: int16
      address: 1046
      input_type: input
      scale: 1
      precision: 1
      state_class: measurement
    - name: "Nibe - Kompressorstarter"
      unit_of_measurement: None
      data_type: int16
      address: 1083
      input_type: input
      scale: 1
      precision: 1
      state_class: measurement
    - name: "Nibe - Köldbärarpumphastighet (GP2)"
      unit_of_measurement: "%"
      data_type: int16
      device_class: power_factor
      address: 1104
      input_type: input
      scale: 1
      precision: 1
      state_class: measurement
    - name: "Nibe - Köldbärarpumphastighet Manuell (GP2)"
      unit_of_measurement: "%"
      data_type: int16
      device_class: power_factor
      address: 222
      input_type: input
      scale: 1
      precision: 1
      state_class: measurement
  binary_sensors:
    - name: "Nibe - Driftläge värmebärarpump"
      address: 853
      input_type: discrete_input
      device_class: power
    - name: "Nibe - Kompressor status"
      address: 1100
      input_type: discrete_input
      device_class: power
    #- name: "Nibe - Driftläge köldbärarpump"
    #  address: 1319
    #  input_type: discrete_input
    #  device_class: power

Enabling logs using

logger:
  default: warning
  logs:
    pymodbus: debug
    homeassistant.components.modbus: debug
    pymodbus.client: debug

Yields the following logs. Sorry for the long entry here

2021-10-10 06:03:09 DEBUG (SyncWorker_6) [pymodbus.transaction] Current transaction state - IDLE
2021-10-10 06:03:09 DEBUG (SyncWorker_6) [pymodbus.transaction] Running transaction 1
2021-10-10 06:03:09 DEBUG (SyncWorker_6) [pymodbus.transaction] SEND: 0x0 0x1 0x0 0x0 0x0 0x6 0x0 0x2 0x3 0x55 0x0 0x1
2021-10-10 06:03:09 DEBUG (SyncWorker_6) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-10-10 06:03:09 DEBUG (SyncWorker_6) [pymodbus.transaction] Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
2021-10-10 06:03:09 DEBUG (SyncWorker_6) [pymodbus.transaction] Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
2021-10-10 06:03:09 DEBUG (SyncWorker_6) [pymodbus.transaction] RECV: 0x0 0x1 0x0 0x0 0x0 0x3 0x0 0x82 0x1
2021-10-10 06:03:09 DEBUG (SyncWorker_6) [pymodbus.framer.socket_framer] Processing: 0x0 0x1 0x0 0x0 0x0 0x3 0x0 0x82 0x1
2021-10-10 06:03:09 DEBUG (SyncWorker_6) [pymodbus.factory] Factory Response[130]
2021-10-10 06:03:09 DEBUG (SyncWorker_6) [pymodbus.transaction] Adding transaction 1
2021-10-10 06:03:09 DEBUG (SyncWorker_6) [pymodbus.transaction] Getting transaction 1
2021-10-10 06:03:09 DEBUG (SyncWorker_6) [pymodbus.transaction] Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE'
2021-10-10 06:03:09 ERROR (SyncWorker_6) [homeassistant.components.modbus.modbus] Pymodbus: Nibe: Exception Response(130, 2, IllegalFunction)
2021-10-10 06:03:09 DEBUG (SyncWorker_10) [pymodbus.transaction] Current transaction state - TRANSACTION_COMPLETE
2021-10-10 06:03:09 DEBUG (SyncWorker_10) [pymodbus.transaction] Running transaction 2
2021-10-10 06:03:09 DEBUG (SyncWorker_10) [pymodbus.transaction] SEND: 0x0 0x2 0x0 0x0 0x0 0x6 0x0 0x2 0x4 0x4c 0x0 0x1
2021-10-10 06:03:09 DEBUG (SyncWorker_10) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-10-10 06:03:09 DEBUG (SyncWorker_10) [pymodbus.transaction] Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
2021-10-10 06:03:09 DEBUG (SyncWorker_10) [pymodbus.transaction] Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
2021-10-10 06:03:09 DEBUG (SyncWorker_10) [pymodbus.transaction] RECV: 0x0 0x2 0x0 0x0 0x0 0x3 0x0 0x82 0x1
2021-10-10 06:03:09 DEBUG (SyncWorker_10) [pymodbus.framer.socket_framer] Processing: 0x0 0x2 0x0 0x0 0x0 0x3 0x0 0x82 0x1
2021-10-10 06:03:09 DEBUG (SyncWorker_10) [pymodbus.factory] Factory Response[130]
2021-10-10 06:03:09 DEBUG (SyncWorker_10) [pymodbus.transaction] Adding transaction 2
2021-10-10 06:03:09 DEBUG (SyncWorker_10) [pymodbus.transaction] Getting transaction 2
2021-10-10 06:03:09 DEBUG (SyncWorker_10) [pymodbus.transaction] Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE'
2021-10-10 06:03:09 DEBUG (SyncWorker_10) [homeassistant.components.modbus.modbus] Pymodbus: Nibe: Exception Response(130, 2, IllegalFunction)
2021-10-10 06:03:09 DEBUG (SyncWorker_9) [pymodbus.transaction] Current transaction state - TRANSACTION_COMPLETE
2021-10-10 06:03:09 DEBUG (SyncWorker_9) [pymodbus.transaction] Running transaction 3
2021-10-10 06:03:09 DEBUG (SyncWorker_9) [pymodbus.transaction] SEND: 0x0 0x3 0x0 0x0 0x0 0x6 0x0 0x2 0x5 0x27 0x0 0x1
2021-10-10 06:03:09 DEBUG (SyncWorker_9) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-10-10 06:03:09 DEBUG (SyncWorker_9) [pymodbus.transaction] Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
2021-10-10 06:03:09 DEBUG (SyncWorker_9) [pymodbus.transaction] Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
2021-10-10 06:03:09 DEBUG (SyncWorker_9) [pymodbus.transaction] RECV: 0x0 0x3 0x0 0x0 0x0 0x3 0x0 0x82 0x1
2021-10-10 06:03:09 DEBUG (SyncWorker_9) [pymodbus.framer.socket_framer] Processing: 0x0 0x3 0x0 0x0 0x0 0x3 0x0 0x82 0x1
2021-10-10 06:03:09 DEBUG (SyncWorker_9) [pymodbus.factory] Factory Response[130]
2021-10-10 06:03:09 DEBUG (SyncWorker_9) [pymodbus.transaction] Adding transaction 3
2021-10-10 06:03:09 DEBUG (SyncWorker_9) [pymodbus.transaction] Getting transaction 3
2021-10-10 06:03:09 DEBUG (SyncWorker_9) [pymodbus.transaction] Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE'
2021-10-10 06:03:09 DEBUG (SyncWorker_9) [homeassistant.components.modbus.modbus] Pymodbus: Nibe: Exception Response(130, 2, IllegalFunction)
2021-10-10 06:03:09 DEBUG (SyncWorker_6) [pymodbus.transaction] Current transaction state - TRANSACTION_COMPLETE

Any ideas why I’m not getting any data?

EDITED

I was missing slave: 1.

More details on solution plus a working home assistant configuration can be found here https://github.com/home-assistant/core/issues/57410#issuecomment-939441649