15.12.2022, 08:40
This example assumes that object name and topic name are the same. mqtt-status tag is for mqtt->object and mqtt-control is for object->mqtt.
Code:
mqtt_to_object = {}
mqtt_to_object_conv = {}
object_to_mqtt = {}
objs = grp.tag('mqtt-control')
for _, obj in ipairs(objs) do
object_to_mqtt[ obj.address ] = obj.name
end
objs = grp.tag('mqtt-status')
for _, obj in ipairs(objs) do
mqtt_to_object[ obj.name ] = obj.address
end