24.05.2022, 07:22
For testing you can enable "Allow anonymous connections (no username/password)" and remove client:login_set(...) from your script.
Instead of adding log calls to the script you can enable logging for a certain object that will be written to via MQTT. Then you can check the timestamps in Object logs to determine how many telegrams are handled per second.
Some further improvements can be made with object datatype caching. Otherwise each grp.write call requires a database query to determine the object data type. But keep in mind that the main bottleneck is KNX/TP low speed.
Instead of adding log calls to the script you can enable logging for a certain object that will be written to via MQTT. Then you can check the timestamps in Object logs to determine how many telegrams are handled per second.
Code:
require('json')
broker = '127.0.0.1'
port = 1883
mqtt = require('mosquitto')
client = mqtt.new()
client.ON_CONNECT = function(status, rc, msg)
log('connect', status, rc, msg)
if status then
client:subscribe('#')
else
client:disconnect()
end
end
client.ON_MESSAGE = function(mid, topic, payload)
local decoded = json.pdecode(payload)
if type(decoded) == 'table' then
for i, m in ipairs(decoded.commands) do
grp.write(m.alias, m.value)
end
end
end
status, rc, msg = client:connect(broker, port)
client:loop_forever()
Some further improvements can be made with object datatype caching. Otherwise each grp.write call requires a database query to determine the object data type. But keep in mind that the main bottleneck is KNX/TP low speed.