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.

Create Modbus client via script
#3
(18.02.2017, 00:03)Erwin van der Zwart Wrote:
Code:
query = 'SELECT * FROM modbus_mapping'
counter = 0
for _, mapping in ipairs(db:getall(query)) do
  if mapping.bus_address == "" or  mapping.bus_address == nil then
    grp_address = '1/1/' .. counter
    if counter < 256 then
      dec_grp_address = knxlib.encodega(grp_address)
      address = grp.create({
      datatype = mapping.datatype,
      address = grp_address,
      name = mapping.name,
      comment = 'Auto mapped by script',
      units = mapping.units,
      tags = {},
      })
      counter = counter + 1
      db:update('modbus_mapping', { bus_address = dec_grp_address, bus_write = 1, value_delta = 0.1, value_custom = 'Auto mapped by script' }, { id = mapping.id })
    end
  end
end
Hi, Erwin!
Could you modify this script to create more then 256 objects at once?
I have profile with around 900 registers and it's not full
Reply


Messages In This Thread
Create Modbus client via script - by FatMax - 17.02.2017, 11:31
RE: Create Modbus client via script - by AEK - 28.09.2017, 16:04
RE: Create Modbus client via script - by AEK - 29.09.2017, 07:56
RE: Create Modbus client via script - by AEK - 02.08.2018, 10:55

Forum Jump: