This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

kWh modbus to KNX convertion?
#1
Hello everyone.

I've been using this code to convert an int16 modbus to an float16 knx.
Code:
    {
      "address": 52,
      "datatype": "int16",
      "bus_datatype": "float16",
      "name": "Total import kWh",
      "value_multiplier": 0.1,
      "type": "register"
    },
it has been working flawless until the total kwh counter reached 3276.7 kwh.
Then it stopped working.
I prosume that the problem is that i run out of data in the 16 bit signed integer. 

Then I tried to change the datatype to int32 an the bus_datatype to 14 (4-byte floating point).
But still no succes. 
Any sugestions on what to do to get the propper readout in KNX? 

The last code I tried is copied from another modbus profile for a powermeter:
Code:
    {
      "address": 52,
      "read_count":20,
      "read_offset":2,
      "datatype": "float32",
      "bus_datatype": "14",
      "name": "Total import kWh",
      "value_multiplier": 0.1,
      "type": "register"
    },
The powermeter I use is a Carlo Gavazzi EM340.
Link to modbus manual: https://gavazzi.se/app/uploads/2020/11/e...340_cp.pdf
Reply
#2
datatype must be set to int32. You might need use a different read_swap. Use Read test to find correct parameters.
Reply
#3
(25.04.2023, 08:05)admin Wrote: datatype must be set to int32. You might need use a different read_swap. Use Read test to find correct parameters.
Can you specify the read test? How do I do that?
Reply
#4
Read test is in the Modbus tab / bottom toolbar.
Reply
#5
Okay, i've done the read test, and it has to be set as follows:
Read Swap: None (ABCD)
Datatype: int32
How do I specify the readswap in the .json file? Smile
Reply
#6
Add "read_swap":"n" to your profile entry. It is all described here: https://openrb.com/docs/modbus.htm
Reply


Forum Jump: