Read Modbus data from Garo gnm3d

Hi. Im trying to read correct responses from a garo gnm3d energymeter via rs485.
documentation for garo gnm3d:
(https://www.garo.se/storage/2F5C05CC57F3034D9178CF1609C9A61D3C9F2C88D08D279962CB906D3C98F1ED/0cbefe64cdbc4fff88737aaf17979044/pdf/media/aa3e752aad0c40bfaa14e62446f4e2ef/108047_5_Protocol%20GNM3D,-T%20Modbus.pdf)

Im a bit confused because the response i get is not just the value as i read the documention.
does anyone got an gnm3d connected to home assistant?
im used to just get the value in the respinse in other modbus applications.

for example reading kw register 300041 gives answer 7 110 000 640 with current setup:

 - type: serial
   name: elcentral
   method: rtu
   port: /dev/ttyUSB0
   baudrate: 9600
   stopbits: 1
   bytesize: 8
   parity: N
   timeout: 2
   sensors:
    - name: em1_kwh_raw
      slave: 1
      address: 40
      input_type: input
      scale: 10
      precision: 0
      data_type: int32      

If i for example read int16 instead (example below) i get correct values for voltage and current but not power and energy

    - name: em1_vl1
      slave: 1
      address: 0
      input_type: holding
      scale: 0.1
      precision: 1
      data_type: int16
      unit_of_measurement: 'V' ´
  data_type: int32 
  count: 2

Hi, cant find what count does. I added it and didnt make any big different. Can you explain more?

I get 14824898560.0
With current setting:

      slave: 1
      address: 40
      input_type: input
      scale: 10
      count: 2
      precision: 1
      data_type: int32      
      unit_of_measurement: 'kW'  

The correct value is 2.2

Count is number of registers

It’s address 41

0028 hex = 40 decimal = 41 modbus decimal

I think… :rofl:

So 0hex = 1 modbus decimal

holy s… this was way more complicated than i expected :wink:

i tried connect my computer straigt the energy meter and fount that if i read “long least significant register first” it looks like the correct values. but how do i configure the sensor to read that way? i found out that i need to add this:

      structure: "what to type here" 
      data_type: custom  

im not shure what to add under structure to read correct , any help please :wink:

You only need swap

swap string (optional, default: none)

Swap the order of bytes/words, options are none, byte, word, word_byte.

It did the thing! Thanks!

1 Like

Hi !
Did you get it to work ?
readings OK in HA ?

and what modbus-device do you use to connect pfysictly to network/HA ?

//Andreas
SkĂĄne

hi yeah wordswap was the solution, I use a simple amazon USB to rs485 stick for connection.
example below for energymeter

    - name: em1_kw
      slave: 1
      address: 40
      count: 2
      input_type: input
      scale: 0.0001
      swap: word
      precision: 1
      data_type: int32      
      unit_of_measurement: 'kW' 

1 Like

Thanks to this post, I was able to understand and retrieve the values from my Garo GNM3D as well.

From the document posted above, table 2.4.1, it made it easy to retrieve whatever; converting hex (physical address - 0028h - where “h” just mean hei) to decimal (address in sensor in configuration.yaml).
Thank you for this (I am too using a cheap USB modbus 485 adapter).

modbus:
  - name: modbus_hub
    type: serial
    port: /dev/ttyUSB1
    baudrate: 9600
    bytesize: 8
    method: rtu
    parity: N
    stopbits: 1
    timeout: 2
    sensors:
    - name: hybel_seriemaler_W
      slave: 1
      address: 40
      input_type: input
      scale: 0.1
      swap: word
      precision: 1
      data_type: int32      
      unit_of_measurement: 'W' 
    - name: hybel_seriemaler_kWh
      slave: 1
      address: 52
      input_type: input
      scale: 0.1
      swap: word
      precision: 1
      data_type: int32      
      unit_of_measurement: 'kWh'