Modbus Connection to Wallbox Value

Hello to all

Most of the parts that i need to read out my Amtron Wallbox are running now, but i have a probleme to read out the ‘Charging session meter count’.
In the Modbus Tool from Radizio it is build up correctly. When i load the car with 500 Wh i see in the tool the value 500 for the address 30782.

But in openHAB the value for the Item shows 420085760 when i begin to load and after the load of 500 Wh it shows 4286262. When i start a new load it resets the value to 420085760 and counts up.

So i investigated that the value 420085760 = 0, because it starts every time at this value.
When i load the car it counts up to what i load and holds the value (e.g. 42008626 for 500Wh) until the next load starts then it beginns with 420085760.

Item:

Description of the address 30782:

Radzio Tool:

Data Thing:

UID: modbus:data:d38acc9062:fa7bc66e42
label: AmtronPwCons
thingTypeUID: modbus:data
configuration:
  readValueType: uint32
  readTransform: default
  writeTransform: default
  readStart: "780"
  updateUnchangedValuesEveryMillis: 1000
  writeMultipleEvenWithSingleRegisterOrCoil: false
  writeMaxTries: 3
bridgeUID: modbus:poller:2687b9fd4b:d38acc9062

readStart 780 is right because i have to count down two from the address

Item:

Number AmtronPwCons                                "Charging Consumption"             <counter>             {channel="modbus:data:d38acc9062:fa7bc66e42:number"}

Do i have to convert the value from the Item or do i have to transform the value, or what i have to do, that i only get the ‘Watt’ or ‘Kw’ as readable value?

Holger

32-bit Modbus - how does it work? Modbus only has 16-bit registers.
That’s okay, we can glue any arbitrary two registers together to make 32. Common sense says to use two adjacent registers, but there is no actual rule about that.
Then there is the order - A+B is different from B+A here, and no rule about that either. We have to find out what the device designer did, or guess.

Amtron are pretty good here - explaining how to make the 32-bit value from registers at addresses x030D and x030E (781 and 782 decimal)
They also make clear that 781 is the low bits and 782 the high.

So that’s wrong, use 781.
Make sure the associated poller Thing includes 781 and 782 as well.

Referring to the binding docs

we can read that uint32 will take (register) and (register+1) to make the 32 bits
but
(register) will be the most significant bits, and (register+1) the least. That’s wrong, the opposite of what Amtron are doing.

Binding allows for value type uint32_swap which will do what we want - it will put the first register in the lowest part of 32-bits

Hi

this Modbus Thing is confusing me. For me it is a little bit of try and error at the moment.

ok so far my poller Thing starts at 772 with a lenght of 16

UID: modbus:poller:2687b9fd4b:d38acc9062
label: Wallbox_State
thingTypeUID: modbus:poller
configuration:
  length: 16
  start: 772
  refresh: 500
  maxTries: 3
  cacheMillis: 50
  type: input
bridgeUID: modbus:tcp:2687b9fd4b

so i followed your advice

and set the DataThing to the read addreess 781 and then i start to charge the car.

Ok, what is see in the DataThing is that my Item value jump to ‘0’ at start and counts up, after i have load around 1 kwh (i see in the app for the Wallbox) i stopped the charging process and looked at the value for the Item in the DataThing.

It show a value of 64684032. I dont know what dimension this value is, but when i going to devide it with
60.000 i get 1.078 and that looks like about 1 kwh.

Where can i now convert this value (64684032) to get the the value in Kwh

Holger

Yes, you have to know precisely what you are trying to achieve.

You can apply a read transformation to your data Thing to divide the value by 60000 (that would be convert Watt-seconds to Wh)

or

use the binding gainOffset profile on the link between data Thing and Item, as shown in the docs
Modbus - Bindings | openHAB

You could use gainOffset to add a unit “kWh” and link to a Number:Energy type Item.

I have tried out your advice with the gainOffset profile, but i can’t figure it out what exactly i must do that it work, most of my tries i get an UNDEF Item value

Can you give me an example how to have the item looks with the gainOffset profile, specially what i have to use for a value gain=“xxx”

Holger

Divide by 60,000 is same as multiply by 0.0000016667, so for a Number type Item
gain=“0.0000016667”
or for a Number:Energy type Item
gain=“0.0000016667 kWh”

Note that editing profiles in flight and/or making/breaking links can be problematic. When you are happy with your edits, but still not seeing what you expect, try a reboot.

Remember we cannot see over your shoulder, its always best to show us what you are doing.

Thats work for me perfectly.

Thank you for your help

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.