Logic Machine Forum
Modbus profiles examples - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: Modbus profiles examples (/showthread.php?tid=839)

Pages: 1 2 3 4 5 6


RE: Modbus profiles examples - tthamm - 03.10.2022

(03.10.2022, 07:54)Daniel Wrote: Try this:
Code:
{   
      "bus_datatype": "int64",
      "address": 20480,
      "type": "register",
      "units": "kWh",
      "value_multiplier": 0.01,
      "name": "Active import",
      "datatype": "uint64"
    },
Try using profile generator if this is simpler.
https://forum.logicmachine.net/showthread.php?tid=3053&pid=19678#pid19678

I´ve tested it but it doesnt work. Here are some pictures. I always get a "operation time out", but the read test works!

                   


RE: Modbus profiles examples - Daniel - 04.10.2022

What are the RTU settings?


RE: Modbus profiles examples - Dré - 04.10.2022

(02.10.2022, 10:48)tthamm Wrote:
(24.01.2022, 07:14)admin Wrote: LM does not have D0/D1 markings, but A/B/GND. A is positive, B is negative. Try swapping A/B lines and also check that the serial port settings match.

now the communikation works!

I´ve found the manufactur manual with chapter 9 (Communication with Modbus) inside.

Here are the fields: Quantity, Details, Start reg (hex), Size, Res., Unit, Data type,

for Example:

Quantity: Active import, Details: Tariff 1, Start reg (hex): 5170, Size: 4, Res.: 0,01, Unit: kWh, Data type: Unsigned

When i try reading Active import with these settings:
- Function: Holding register (#3)
- Address: 20480
- Data type: uint64
- Read swap: Word

the Answer is 94425 (i think its 944,25 kWh), that is correct.

but how i have to "translate" for the Logicmachine? I know, that i have to calculate hex into dec (like 5000 in hex is 20480 in dec). In the Modbus Profile Generater are Fields like bus_datatype, datatype, value_custom, read_swap...

Can you give me an example? Thankx

I have the ABB B21 and have the next script what is working, maybe this can help you?

Code:
{
  "product_code": "ABB_B21",
  "mapping": [
    {
      "bus_datatype": 14,
      "address": 20480,
      "value_multiplier": 0.01,
      "type": "register",
      "units": " kWh",
      "name": "Active import",
      "datatype": "int64"
    },
    {
      "bus_datatype": 14,
      "address": 20484,
      "value_multiplier": 0.01,
      "type": "register",
      "units": " kWh",
      "name": "Active export",
      "datatype": "int64"
    },
    {
      "bus_datatype": 14,
      "address": 20488,
      "value_multiplier": 0.01,
      "type": "register",
      "units": "kWh",
      "name": "Active Net",
      "datatype": "int64"
    },
      {
      "bus_datatype": 14,
      "address": 20489,
      "value_multiplier": 0.01,
      "type": "register",
      "units": "Kvarh",
      "name": "Reactive Import",
      "datatype": "int64"
    },
     {
      "bus_datatype": 14,
      "address": 20496,
      "value_multiplier": 0.01,
      "type": "register",
      "units": "Kvarh",
      "name": "Reactive Export",
      "datatype": "int64"
    },
     {
      "bus_datatype": 14,
      "address": 20500,
      "value_multiplier": 0.01,
      "type": "register",
      "units": "Kvarh",
      "name": "Reactive Net",
      "datatype": "int64"
    },
         {
      "bus_datatype": 14,
      "address": 20504,
      "value_multiplier": 0.01,
      "type": "register",
      "units": "Kvarh",
      "name": "Apparent Import",
      "datatype": "int64"
    },       
     {
      "bus_datatype": 14,
      "address": 20505,
      "value_multiplier": 0.01,
      "type": "register",
      "units": "Kvarh",
      "name": "Apparent Export",
      "datatype": "int64"
    },
         {
      "bus_datatype": 14,
      "address": 20512,
      "value_multiplier": 0.01,
      "type": "register",
      "units": "Kvarh",
      "name": "Apparent Net",
      "datatype": "int64"
    },      
     {
      "bus_datatype": 14,
      "address": 20516,
      "value_multiplier": 0.001,
      "type": "register",
      "units": "kg",
      "name": "Active Import CO2",
      "datatype": "int64"
    },
         {
      "bus_datatype": 14,
      "address": 20532,
      "value_multiplier": 0.001,
      "type": "register",
      "units": "currency",
      "name": "Active Import Currency",
      "datatype": "int64"
     },
              {
      "bus_datatype": 14,
      "address": 23296,
      "value_multiplier": 0.1,
      "type": "register",
      "units": "currency",
      "name": "Volatage",
      "datatype": "int64"
     },
                   {
      "bus_datatype": 14,
      "address": 23316,
      "value_multiplier": 0.01,
      "type": "register",
      "units": " W",
      "name": "Active power",
      "datatype": "int64"
     },
                        {
      "bus_datatype": 14,
      "address": 23296,
      "value_multiplier": 0.1,
      "type": "register",
      "units": " V",
      "name": "Voltage L1-N",
      "datatype": "int32"
     },
    {
      "bus_datatype": 14,
      "address": 23308,
      "value_multiplier": 0.01,
      "type": "register",
      "units": " A",
      "name": "Current Ampere L1",
      "datatype": "int32"
     },
     {
      "bus_datatype": 14,
      "address": 23316,
      "value_multiplier": 0.01,
      "type": "register",
      "units": " W",
      "name": "Active Total Power",
      "datatype": "int32"
     },
     {
      "bus_datatype": 14,
      "address": 23340,
      "value_multiplier": 0.01,
      "type": "register",
      "units": " Hz",
      "name": "Frequency",
      "datatype": "uint16"
     },
     {
      "bus_datatype": 10,
      "address": 35328,
      "value_multiplier": 0,
      "type": "register",
      "units": " time",
      "name": "date / time",
      "datatype": "int64"
     }
    ],
  "manufacturer": "ABB",
  "name": "B21",
  "product_range": "PM",
  "description": "Power Meter P21 1 fase",
  "read_delay": 1
}


The last read_delay is because is had 2 devices and the next device i activate didn't work
link to post from Admin


RE: Modbus profiles examples - efredlund@gmail.com - 14.12.2022

(04.11.2020, 20:56)stemic01 Wrote: FYI: I've just implemented and written a modbus JSON profile for the FLEXIT NORDIC S4 ventilation system. Now I can retrieve vital information and change certain parameters. PM if you are in need of this for your flexit. (PS! The CI66 JSON did not work for me).

Hello, I have also tried the CI66 JSON with no success. Are you interested in sharing your file that would be great Smile

My unit is a Flexit Uni 4

Regards


Modbus profiles examples - fabiorusco - 27.12.2022

Hallo,
I created this modbus profile, but if I try to import it in LM, it show me "invalid profile":

{
  "manufacturer": "Rehom",
  "description": "Unità Master",
  "product_code": "REH11001",
  "mapping":
[
    {
      "name": "richiesta_lettura_dati",
      "bus_datatype": 7,
      "type": "register",
      "address": 6,
      "writable": "true"
    },
    {
      "name": "richiesta_lettura_contatore",
      "bus_datatype": 7,
      "type": "register",
      "address": 7,
      "writable": "true"
    },
    {
      "name": "consumo_calorie",
      "bus_datatype": 14,
      "units": "kWh",
      "type": "register",
      "address": 3015,
      "value_multiplier": 1
    },
    {
      "name": "consumo_frigorie",
      "bus_datatype": 14,
      "units": "kWh",
      "type": "register",
      "address": 3017
      "value_multiplier": 1
    }
  ]
}

Can someone help me please

Best regards
Fabio Rusconi


RE: Modbus profiles examples - CristianAgata - 28.12.2022

(27.12.2022, 14:48)fabiorusco Wrote: Hallo,
I created this modbus profile, but if I try to import it in LM, it show me "invalid profile":

{
  "manufacturer": "Rehom",
  "description": "Unità Master",
  "product_code": "REH11001",
  "mapping":
[
    {
      "name": "richiesta_lettura_dati",
      "bus_datatype": 7,
      "type": "register",
      "address": 6,
      "writable": "true"
    },
    {
      "name": "richiesta_lettura_contatore",
      "bus_datatype": 7,
      "type": "register",
      "address": 7,
      "writable": "true"
    },
    {
      "name": "consumo_calorie",
      "bus_datatype": 14,
      "units": "kWh",
      "type": "register",
      "address": 3015,
      "value_multiplier": 1
    },
    {
      "name": "consumo_frigorie",
      "bus_datatype": 14,
      "units": "kWh",
      "type": "register",
      "address": 3017
      "value_multiplier": 1
    }
  ]
}

Can someone help me please

Best regards
Fabio Rusconi

Hi Fabio,
After "address":3017 there's no the ,
BR Cristian


RE: Modbus profiles examples - fabiorusco - 28.12.2022

(28.12.2022, 05:47)CristianAgata Wrote:
(27.12.2022, 14:48)Thank you,Fabiofabiorusco Wrote: Hallo,
I created this modbus profile, but if I try to import it in LM, it show me "invalid profile":

{
  "manufacturer": "Rehom",
  "description": "Unità Master",
  "product_code": "REH11001",
  "mapping":
[
    {
      "name": "richiesta_lettura_dati",
      "bus_datatype": 7,
      "type": "register",
      "address": 6,
      "writable": "true"
    },
    {
      "name": "richiesta_lettura_contatore",
      "bus_datatype": 7,
      "type": "register",
      "address": 7,
      "writable": "true"
    },
    {
      "name": "consumo_calorie",
      "bus_datatype": 14,
      "units": "kWh",
      "type": "register",
      "address": 3015,
      "value_multiplier": 1
    },
    {
      "name": "consumo_frigorie",
      "bus_datatype": 14,
      "units": "kWh",
      "type": "register",
      "address": 3017
      "value_multiplier": 1
    }
  ]
}

Can someone help me please

Best regards
Fabio Rusconi

Hi Fabio,
After "address":3017 there's no the ,
BR Cristian



RE: Modbus profiles examples - admin - 28.12.2022

Profile is missing datatype fields, most likely kWh readings will be incorrect. Can you provide documentation for this device?


RE: Modbus profiles examples - fabiorusco - 28.12.2022

(28.12.2022, 07:30)admin Wrote: Profile is missing datatype fields, most likely kWh readings will be incorrect. Can you provide documentation for this device?

Hello,
I inserted them like uint32.

Thank you


RE: Modbus profiles examples - pritorianz - 10.03.2023

Hi all!
I made and checked the profile for the Haier YCJ-A002 module (for connecting Haier air conditioners via Modbus).
For writing, I used the site https://jsoneditoronline.org/
And modbus profile generator https://forum.logicmachine.net/showthread.php?tid=3053&pid=19678#pid19678


LG AWHP Modbus RTU Profile - KoBra - 08.04.2023

Dears,

attached the Modbus RTU direct connection profile of LG AWHP to logic machine incl all custom values.


LG AirCondition PMBUSB00A Modbus profile - merel - 08.04.2023

Hello everbody,

attached the Modbus RTU direct connection profile of LG PMBUSB00A LG Modbus Gateway to logic machine incl all custom values..


RE: Modbus profiles examples - AEK - 25.09.2023

Hi, small script, which will help to create json profile for daikin modbus interface DIII (D3)
Code:
require('json')
data = {
  manufacturer = "daikin",
  description = "modbus gateway",
  mapping = {
    {
      }
    }
  }



str = json.encode(data)
--log(str)
--io.writefile('home/ftp/modbus.json', str)
ac_zones = {
  [1] ={
    [0] = '2_15 Мастер спальня',
    [1] = '2_01 Прихожая',
    [2] = '2_07 Cпальня 2',
    [3] = '2_02 Cпальня 1'   
    },
  [2] ={
    [0] = '1_18 Каминная',
    [1] = '1_16 Холл 2',
    [2] = '1_09 Массажная',
    [3] = '1_08 Спортзал',
    [4] = '1_04 Гостиная',
    [5] = '1_05 кухн'   
    },
  [3] ={
    [0] = '0_06-1 Бар',
    [1] = '0_06-2 Бар',
    [2] = '0_03 ДК'   
    },
  }
function ac_mapping_create (zones_table)
  mapping_table = {}
  for line, zones in pairs(zones_table) do
    for unit, name in pairs(zones) do
      -- статус подключения
      table.insert(mapping_table,
        {
          name = name.." - connection",
          type = "inputregister",
          bus_datatype = "bool",
          address = 1 + (line-1),
          datatype =  "int16",
          value_bitmask = 2^(unit)
          }
        )
      -- ошибка коммуникации
      table.insert(mapping_table,
        {
          name = name.." - communication error",
          type = "inputregister",
          bus_datatype = "bool",
          address = 5 + (line-1),
          datatype =  "int16",
          value_bitmask = 2^(unit)
          }
        )
      -- уставка
      table.insert(mapping_table,
        {
          name = name.." - setpoint ctrl",
          type = "register",
          bus_datatype = "temperature",
          address = 2002 + (line-1)*16*3 + unit*3,
          datatype =  "int16",
          writable = 1,
            write_only = 1,
          value_multiplier = 0.1
          }
        )
        table.insert(mapping_table,
        {
          name = name.." - setpoint status",
          type = "inputregister",
          bus_datatype = "temperature",
          address = 2002 + (line-1)*16*6 + unit*6,
          datatype =  "int16",
          value_multiplier = 0.1
          }
        )
      -- текущая
      table.insert(mapping_table,
          {
          name =  name.." - Room temp",
          type = "inputregister",
          bus_datatype = "temperature",
          address = 2004 + (line-1)*16*6 + unit*6,
          datatype = "int16",
          value_multiplier = 0.1
        }
        )
      -- opermode
      table.insert(mapping_table,
          {
          name =  name.." - Operation mode status",
          type = "inputregister",
          bus_datatype = "uint8",
          address = 2001 + (line-1)*16*6 + unit*6,
          datatype = "int16",
          value_bitmask = 15
        }
        )
      table.insert(mapping_table,
        {
          name = name.." - Operation mode ctrl",
          type = "register",
          bus_datatype = "uint8",
          address = 2001 + (line-1)*16*3 + unit*3,
          datatype =  "int16",
          writable = 1,
            write_only = 1,
          value_bitmask = 15,
          write_bitmask = true
          }
        )
      --fan st
      table.insert(mapping_table,
          {
          name =  name.." - fan speed status",
          type = "inputregister",
          bus_datatype = "uint8",
          address = 2000 + (line-1)*16*6 + unit*6,
          datatype = "int16",
          value_bitmask = 28672
        }
        )
      table.insert(mapping_table,
          {
          name =  name.." - fan status",
          type = "inputregister",
          bus_datatype = "uint8",
          address = 2000 + (line-1)*16*6 + unit*6,
          datatype = "int16",
          value_bitmask = 32
        }
        )
      -- power st
      table.insert(mapping_table,
          {
          name =  name.." - onoff status",
          type = "inputregister",
          bus_datatype = "uint8",
          address = 2000 + (line-1)*16*6 + unit*6,
          datatype = "int16",
          value_bitmask = 1
        }
        )
      -- controls
      table.insert(mapping_table,
        {
          name = name.." - fan speed ctrl",
          type = "register",
          bus_datatype = "uint8",
          address = 2000 + (line-1)*16*3 + unit*3,
          datatype =  "int16",
          writable = 1,
            write_only = 1,
          value_bitmask = 28672,
          write_bitmask = true
          }
        )
      table.insert(mapping_table,
        {
          name = name.." - fan flag ctrl",
          type = "register",
          bus_datatype = "uint8",
          address = 2000 + (line-1)*16*3 + unit*3,
          datatype =  "int16",
          writable = 1,
            write_only = 1,
          value_bitmask = 240,
          write_bitmask = true
          }
        )
      table.insert(mapping_table,
        {
          name = name.." - onoff ctrl",
          type = "register",
          bus_datatype = "bool",
          address = 2000 + (line-1)*16*3 + unit*3,
          datatype =  "int16",
          writable = 1,
            write_only = 1,
          value_bitmask = 1,
          write_bitmask = true
          }
        )
      end
    end
  return mapping_table
  end
data.mapping = ac_mapping_create(ac_zones)

str = json.encode(data)
log(io.writefile('home/ftp/KP1_DAIKIN_modbus.json', str))
just fill the ac_zones table according to your room names
ac_zones[i][j]
i - line(1-4)
j - ac unit (00-15)

and then download profile fromlocal ftp server using "ftp" login. you can add more registers if it is needed


RE: Modbus profiles examples - fabiorusco - 30.09.2023

Hello,
I used a scheduled script to read the modbus register. In the device instructions it's indicated that I must repeat the reading in case of error. I attach the script that I used to detect if there is an error. It doesn't work. Can someone help me, please?

nappartamento = grp.getvalue('32/1/2')
nappartamento = nappartamento + 1
if (nappartamento > 211 ) then
nappartamento = 200
end
grp.update('32/1/2', nappartamento)
log(nappartamento)
require('luamodbus')
mb = luamodbus.rtu()

mb:open('/dev/ttyUSB0', 9600, 'N', 8, 1, 'H')
mb:connect()
mbConfusedetslave(32) --CENTRALINA MASTER
--IMPOSTO LETTURA NAPPARTAMENTO
contatore1=1
mb:writeregisters(7, nappartamento)
os.sleep(10)
--RIPETO SE RISPONDE CON ERRORE 5 VOLTE
contatore1=1
while (contatore1 > 0) do
  res, err = mb:readregisters(7, nappartamento)
if not res then
    os.sleep(30)
    mb:writeregisters(7, nappartamento)
  contatore1 = contatore1 + 1
  if contatore1 > 5 then
      alert('errore1')
    return
  end
else -- TUTTO OK
contatore1=0
  end
end

mb:writeregisters(6, nappartamento)
os.sleep(35)
--RIPETO SE RISPONDE CON ERRORE 5 VOLTE
contatore2=1
while (contatore2 > 0) do
  res, err = mb:readregisters(6, nappartamento)
if not res then
    os.sleep(30)
    mb:writeregisters(6, nappartamento)
  contatore2 = contatore2 + 1
  if contatore2 > 5 then
      alert('errore2')
    return
  end
else -- TUTTO OK
contatore2=0
  end
end




-- LEGGO VALORI
--log(mb:readregisters(3015,8))
os.sleep(1)
calorieh,caloriel,frigorieh,frigoriel,acs_lo,afs_lo,acs_hi,afs_hi = mb:readregisters(3015,8)
calorie = caloriel + (calorieh*65535)
log(calorie)
frigorie=frigoriel + (frigorieh*65535)
log(frigorie)
acs=acs_lo+(acs_hi*65535)
log(acs)
--afs=afs_lo+(afs_hi*65535)
--RIPETO SE RISPONDE CON ERRORE 5 VOLTE
mb:close()


RE: Modbus profiles examples - Erwin van der Zwart - 30.09.2023

Looked quickly and noticed this already:

res, err = mb:readregisters(6, nappartamento)

Where nappartamento seems to be a value around 200 resulting in a command where you try to read register 6 to 206 at once and those 200 registers probably don’t even exist (consecutive), given the “res, err =“ you probably want to read only register 6..

I think your command needs to be:
res, err = mb:readregisters(6)


RE: Modbus profiles examples - tomnord - 30.09.2023

I'm trying to figure out how to combine two registers as one. I want to read register 11(high) and 12(low) as one value. value_bitmask?


RE: Modbus profiles examples - Erwin van der Zwart - 01.10.2023

Same question as yesterday..

https://forum.logicmachine.net/showthread.php?tid=4998&pid=32303#pid32303

Change datatype and swap as needed ..


NIBE S1155 Modbus profile - merel - 25.01.2024

Hello,
here is modbus profile for NIBE S1155 heat pump.


RE: Modbus profiles examples - Tuwat47 - 16.07.2024

.pdf   Board controller.pdf (Size: 1.61 MB / Downloads: 9)
.json   DAIKIN_EWYT.json (Size: 3.98 KB / Downloads: 16)

Hello everbody,

attached the Modbus RTU connection profile for Daikin EWYT to logic machine. Not all the Modbus address are compiled so in attached you can find also all the documentation you could need for implementing more registers.

Hello everbody,

attached the Modbus RTU connection profile for KWB Multifire to logic machine. Not all the Modbus address are compiled so in attched you can find also all the documentation you could need for implementing more registers.


RE: Modbus profiles examples - epps - 23.09.2024

Hello everyone,

want to share some Modbus profiles.
We implement this devices in the last few years.
Hope it helps.

Kind regards 
Epps