How do I config modbus tcp for Nibe S1255?

Once you have the Nibe modbus integration setup, you can use call service “Modbus: Write coil” and just enter address, state, slave and hub name and you’re set.
Example to create a switch to turn on/off “More Hot Water”:

      - name: nibe_morehotwater
        write_type: holding
        address: 697
        slave: 1
        command_on: 2
        command_off: 0

You can use the same principle for many others functions, such as offset.

I control the pump with the above switch for the hot water and for heating, I’ve created an input select list to control the heater power limit with an automation, using the call service mentioned above.

I’ve even managed to automate this with our solar panels, with triggers, that if solar production > 1kw, increase heater power limit by 1kw.
If buying > 1kw from grid, decrease heater power limit by 1kw.
Basically minimizing consumption from the heater when in “buying” mode and maximizing when we have more energy being produced from the solar panels.

To save energy from when the heater isn’t needed, I can just turn the heating function off completely by setting the power limit to 0kw.

3 Likes

Birdman86, this is cool but can you share examples of your switches code? I have the more hot water one, but other like offset etc?

Also which model heat pump do you have?

The code for the switches are simple and identical, except of course for the addresses and the on/off commands.
I deleted all my switches as I figured that I no longer need them for my setup.
I have the S320 modell.

Are you connecting via modbus tcp? Does your system use the Nibe uplink or myUplink service?

Connecting through Modbus TCP.
Not sure how it is connected to the Uplink service, or if you’d require a Premium account to use the modbus function but I have an active myUplink service subscription since I have an S-series heater/pump, the S320.

Again, the switch code is the same. You just need to figure out the address for the correct function and also the command for each function.
Those are all in the Nibe Modbus manual, or alternatively if you have a S-series model, you can just plug in a USB stick and dump all the available commands on it and find out which ones you need.

Yes we are trying to figure all that out in another discussion. Elupus the author of the current Nibe integration is trying to incorporate all that. I have sent over all the registers.

Maybe if you have any information to contribute that would be great.

Checkout the thread here.

https://community.home-assistant.io/t/how-to-connect-to-nibe-heat-pump-without-the-cloud/381099/49

It seems the modbus.write_register service wont allow negative numbers, but we can write a positive number that when interpreted as a signed 16-bit integer it turns into the negative number we want. So for -1 you would write 65535, -2 is 65534 and so forth.

I tested this just now on my VVM S320, setting register 30 (i.e. heating curve offset). Verified both by reading it back in home assistant and using the MyUplink app. You can use 2’s compliment to turn e.g. negative slider values into the correct value to write. I’m new to everything HA and it’s the middle of the night so that will be a task for another day. I’ll post the configuration then, unless somebody beats me to it.

Edit: Ehm actually just add 65536 to the number, if it’s negative

2 Likes

Cool, that is exactly the same I‘m trying to achieve with my S320 and PV.
I wasn‘t aware that you can control power limits with the S320, how are you doing that? Habe you installed the power metering clamps and read it via BE1/BE2/BE3?

Would be awesome if you could share your nibe config and the PV automation yaml :slight_smile:

1 Like

I am trying to use the switch in my Nibe S1155 which has the same holding register, but it does not seem to react to the modbus write. Did you get the integer value for the on from the export in the pump? I do not see in my export row in the csv which value I should use.
Thanks!

Yes, you can control the limit by using call service modbus.write_register and write to address 102 with these values:
0 - 0 kw, as in off.
200 - 2 kw
300 - 3 kw

700 - 7 kw
900 - 9 kw

There is no option for 8 kw.
You can use the same address to read the current limit.

Here is a simple YAML config to get you started:

alias: Automation - Nibe Auto
description: ""
trigger:
  - platform: time_pattern
    seconds: /10
    id: Every 10 seconds
condition: []
action:
  - if:
      - condition: trigger
        id: Every 10 seconds
      - condition: numeric_state
        entity_id: sensor.solar_production
        above: 1000
        alias: Solar Panels producing more than 1 kW
      - condition: numeric_state
        entity_id: sensor.nibe_power_usage
        above: 1.5
        below: 3.5
        alias: Heater uses 2 kW
    then:
      - service: modbus.write_register
        data:
          address: 102
          slave: 1
          hub: Nibe
          value: 300
        alias: Raise Nibe power limit to 3 kW
        enabled: true
    alias: If Power production greater than power consumption - Raise power limit by 1 kW
  - if:
      - condition: trigger
        id: Every 10 seconds
      - condition: numeric_state
        entity_id: sensor.power_consumption
        above: 200
        alias: Power consumption greater than 200 W
      - condition: numeric_state
        entity_id: sensor.nibe_forbrukning
        above: 1.5
        below: 2.5
        alias: Heater uses 2 kW
    then:
      - service: modbus.write_register
        data:
          address: 102
          slave: 1
          hub: Nibe
          value: 0
        alias: Set Power Limit to 0 kW, ie. turn off heater
    alias: If power consumption greater than power production - lower Power Limit by 1 kW
mode: single

It depends on which function/address you’re trying to write to.
The modbus manual from Nibe (google it) sometimes gives you the available options for that specific address.

For those of you who read 2166 Instantaneous Power here. I see that you read it as int16. The databases have it as int32 with an odd unit of “Ws”. Could you guys verify the value you get from this perhaps against your whole household usage?

It could be that it should be int32 with a scaling factor of 100 and in kW. That would match how this field is set up on the F-series pumps.

Hi Marcel,

did you manage to achieve this?
I’m trying to do basically the same thing.
But when reading the flow meters, I only get bogus results. I’ve compared them to the ones shown in the device itself. And the ones in HA are nowhere near…

Kind regards,
Manuel

Hi birdman86, I just setup a S320 with F2125 and ran into a problem. Register 2166 as in document M12676EN does not give me a correct value, this should be the instantaneous power consumption but after 5 days of monitoring this appears constantly at 875w, this is quite strange. Did you also use the same registry?
Thank you

Hi @SteveOmero,
How did you implemented your S320 as the default integration (Nibe Heat Pump - Home Assistant) for S320 is not working on my end?
I am not getting any values.
Thanks for your feedback.

Hi T_A I have implemented a monitor through NODERED+Ignition as DB and Graphana to publish the result. I’m monitoring at the moment few data like BT1 BT2 BT3 GP1 and BT50 get from MODBUS
I’m looking for any other value. In the document M12676EN many registers don’t work with S320.

Hi, Is it simply stored in Watt seconds (Ws) ?

Can you tell me what entity is the compressor status… Mine is an SMO S40 but in the compressor status it just has values of 20 or 60

Not sure what you mean? I have an entity on my S1255 which is called compressor status and displays either a value of 1.0 for On or 0.0 for Off.

Hi all! I have a quite weird behavior that I’m not able to sort out in my Modbus connection to my S1155. I have solar panels with an EME20 and the instantaneous power is exported through coil 2178. If I use mbpoll I get the following value:

$mbpoll -a 1 -r 2178 -t3 -l 10000 192.168.1.34
[2178]: 212

which corresponds to 2.12 kW which is correct, but in my home assistant sensor, configured like this:

  • name: “Nibe_solcell_total_avg_power”
    unique_id: “nibe_solcell_tot_avg_power”
    data_type: uint32 # int8
    address: 2178
    input_type: input # R/W
    precision: 2
    state_class: measurement
    unit_of_measurement: “kW”
    scale: 0.01
    slave: 1
    scan_interval: 30

I get a completely different value of 135661.57 kW, which obviously is quite wrong… What am I doing wrong in the configuration of the sensor? Any hints?

The info in the Nibe manual for Modbus tends to be outdated, but an export of the modbus registrers shows the folllowing:
Title Register type Register Division factor Unit Size of variable Min value Max value Default value
Total average power (EME 20) MODBUS_INPUT_REGISTER 2178 100 kW 6 0 0 0
Total energy MODBUS_INPUT_REGISTER 2180 10 kWh 3 0 0 0

Note the different in the variable size between the register 2178 (size 6… bytes I assume?) and the register 2180 with size 3… I don’t get any wiser on how to map that variable size to the modbus data type…

Thanks!
/Nacho