My heatpump continues to give me grey hairs. This time, a lot of settings are stored in the register array belonging to function code 0x06.
The way addressing has been done in the controller is that for each function code area, the first address is always 0x01. Meaning addressing the first coil register uses 0x01 0x01. First holding register uses 0x03 0x01. First input register uses 0x04 0x01. First register in the array which can be changed used 0x06 0x01 - with this first address only as read-only, and if that value of the first register shall be changed the address is different as “Add 0x0100 to Register address for writing request (only for address 0x0001 – 0x0091 )” according to the spec of the controller.
When “reading” using the 0x06 function the payload is “Value is Do-Not-Care on reading only.”
This means that using the values stored in the 0x06 array, one has to “write” to the lower part of the array to get the register values returned. In turn, those returned values shall be parsed to HA sensors as if I was using function codes 0x01, 0x03 or 0x04.
Hello Lars,
I’m also starting with home assistant to controll units via Modbus RTU.
sufficient
Perhaps a change of sight might help:
Modbus is the communication and has only very limited “vokabulary”, the “Function codes”. Simplified: you can read or write a single Bit or one or more complete bytes. So about 6 function codes are sufficient.
The registers are the memory of the unit, you want to control. And they are very deep on the hardware-level of the unit to be coltrolled. Therefore mostly directly in hex-notation.
If you view from outside, from the Modbus Master, they can be “read only” (e.g. a temerature value) oder “read and write” (e.g. a Bit-pattern that switches the contolled unit into a certain modus).
If you want th read a value out of a register, this can be done by the Modbus integration directly. If you want to write from HA down into a register of the unit to controll something, there is a separate write-service, that hast to be triggered by your home assistant environment.
This is my point of knolledge so far, I cant give further step by step-help so far.
Thanks Stefan.
That is correct if the implementation follows the modbus specification.
You read holding register via fc 0x03 and write the holding register via fc 0x06.
However, my special implementation of modbus does not share sddress space between fc 0x03 and 0x06. In fact the register you read with 0x03 on address 0x01 is not the same register you write to with 0x06 on address 0x01.
You read address 0x101 by writing a dummy value to address 0x01 using fc 0x06.
You write address 0x101 by using fc0x06