Modbus Int64

I’m trying to get the modbus integration to read a Int64 from my power meter.

Holding register: 3204
Data Type: Int64
Unit: Wh

./modpoll -t 4:hex -i -f -a 1 -r 3204 -c 4 -1 <ip>
– Polling slave… (Ctrl-C to stop)
[3204]: 0x0000
[3205]: 0x0000
[3206]: 0x1EA0
[3207]: 0x4688

On the screen of the meter the value reads: 513491.1 kWh (but the manual says the value returned by modbus is in Wh)

No combination of parameters like “swap” and “count” get me to the value even of 513491.1 kWh

Any advice on how to get the correct value?

I am able to get float32 values without issue (like voltage).

Start at 3206 and count 2

Maybe is rounded some way

1E A0 46 88 = 513820296

Thanks for the advice. I had to change to an int32 to avoid HA throwing a conversion error and subtract ‘1’ from all of my register values as it seems the integration is fixed to 0-based numbering.

- name: Mains Total Active Energy
      unique_id: active_energy
      device_class: energy
      state_class: total_increasing
      input_type: holding
      scale: 0.001
      precision: 2
      unit_of_measurement: kWh
      data_type: int32
      count: 2
      slave: 1
      address: 3205
1 Like

Hey @beerygaz can you share an example for the configuration you have done, in the above solution I didn’t get the subtracting 1 from the register values. An example regarding the same could be a great help for me.

I’m also stuck in with the Schneider PM3250.

Sorry for the late reply. In the Schenider documentation for my power meter, the “Mains Total Active Energy” modbus register is 3206 and an Int64. Given each register can hold an Int16, we’d need to read 4 registers (3206/7/8/9) and then combine them to get the actual value.

Some modbus systems start counting their registers from 1 and some from 0 - it seems the HA implementation always uses 0-based register numbers, whereas the. Schneider documents use 1-based.

So instead of reading 4 registers 3206/7/8/9 per the manual, I tell HA to read 3205/6/7/8 - subtract ‘1’ form the register the manual says to use.

You’ll also see that I ask HA to read an int32 data_type: int32 with a count of 2 count: 2. An int32 would be two consecutive int16 registers - so 2 x int32 = 4 x int16 = 1 int64 value.

I hope that makes some sense?

Thanks for the replay!

We have tried this already and this solution is not working for us.