(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. I think I found small Error in this script.
datatype = mapping.datatype - with this we are creating object with modbus datatype
i think it should be
datatype = mapping.bus_datatype