28.09.2017, 16:04
(18.02.2017, 00:03)Erwin van der Zwart Wrote:Hi, Erwin!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
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