Modbus register

Hello,

I’m a noob and I want to write temperature to my Stiebel Eltron heatpump.

After reading some topics I clearly don’t see it.

Modbus entry (-1)

set-temp-01

Current YAML config

    climates:
    - name: "water_heatpump_climate"
      address: 1001
      slave: 1
      input_type: holding
      max_temp: 70
      min_temp: 30
      precision: 1
      target_temp_register: 2
      temp_step: 1
      temperature_unit: C
      hvac_onoff_register: 0
      write_registers: true
      offset: -15
      scale: 0.5
    actions:
    - action: modbus.write_register
      metadata: {}
      data:
        hub: ISG
        address: 1001
        value: 1

Output

I understand that my question is basic HA but I don’t see it so please be gentle :wink:

Thanks

Christoph

You may not be connected to the device.

Simplest place to start may be to configure a sensor and see if you can read the value from the register.

1 Like

I can read the value but I can’t register …

Can someone put his code in here ?

Thanks

Can some one give me a sort of yaml code to achieve this one ?

Once more I don’t want to be lazy but I don’t get the structure

Christoph

Ok let’s start simple

What do I have to do to write 25 degrees to

climate-02

Thanks

First of all I doubt that a modbus address expecting a temperature value would wait for a string. Remove the doublequotes since it 's more likely an int16 I guess.

if the name used for the hub is correct … can’t say since that’s something you defined since so it’s only you being able to validate that.

And for the address.
real humans do count things starting from 1,2,3, …
computernerds thinking in arrayitems, loops, to count 0,1,2, …
so yes it could happen that all addresses from the modbus documentation of your device need an offset of 1.

OK i’ve made some progress

I’m able to change the mode with this code

data:
  address: 1500
  value: 5
  hub: ISG
action: modbus.write_register

That changes the operation mode

But initially I want to change climate temperature

I know that I have to search for de right modbus address and that’s not the question here but I’m searching for the yaml code.

Thanks

to write, lets say by pressing a custom:button-card

tap_action:
  action: call-service
  service: modbus.write_register
  data:
    hub: ISG
    address: 1500
    slave: 1
    value: 5

to permanntly read a value from that addess (if modbus tcp)

modbus:
  - type: tcp
    host: <the ip> of the device with the modbus server
    port: 502 # or a correct portnumber
    name: ISG # <== that's the HUB name which you already used earlier
    sensors:
      - name: operation mode
        unique_id: operation_mode
        scan_interval: 30
        slave: 1
        address: 1500
        data_type: int16 # whatever datatype 8 from your docs mean

result would be an entity name operation_mode with a value which does fit into an int16 if defined like that.

But it depends upon your documentation since in your picture is says datatype=8 … whatever datatype that is.
There’s 3 times an X in the picture, WPM-sysem WPM 3 WPM31 since so it could also be that you have to read-write a bitfield.
Perhaps there’s a section in the document where datatype is explained?

Wooow it works !!!

I can thank you enough !!!

More questions are incoming but I’m getting somewhere

Christoph

Sure since that’s sort of the lowest level modbus offers. But it’s essential to get a common understanding about how to read/write a single address, then multilple addresses and such like.
And you need to read about differnt datatypes in case there’s values which won’t fit into an int16 for example.

If you’re familar with such things you could head over to the special use cases such as climate and others.

In the end modbus is easier but creating tempates for a template sensor, since all what happens is reading/writing single values. Mostly times, since sometimes there’s scale factors. A good example is if you want to handle floats.
Most devices do this by storing an int value + a scale factor.
Means 25.5°C is likely stored using 255 in 1 address and a scale factor of -1 in another. So that addr1 * 10^addr2 finally gives you 22.5
The important thing with that is … if you want to write a changed temperature you must remember that a scale factor will be used, means writing back 24°C would result the device would treat that as 2.4°C due to the scale factor. Since so you must write 240 to the addr1. Something one should keep in mind in case one runs into problems where a written new value differs by a factor of 10 or 100, whichever scalefactor is used.
It’s also possible that there’s no second addr with a scale factor but a comment in your documentation of the device that a scale factor must be used.

Try to get familar with modbus … it’s real fun in the end since it’s as rock solid integration and it’s a well established standard anyway.