--- a/mqtt/client.py Wed Jul 17 17:02:32 2024 +0200
+++ b/mqtt/client.py Thu Jul 18 11:28:38 2024 +0200
@@ -137,24 +137,33 @@
current_location = self.GetCurrentLocation()
locstr = "_".join(map(str, current_location))
name = self.BaseParams.getName()
- for direction, data in self.modeldata.iteritems():
- iec_direction_prefix = {"input": "__I", "output": "__Q"}[direction]
- dname, ua_nsidx, ua_nodeid_type, _ua_node_id, ua_type, iec_number = row
- iec_type, C_type, iec_size_prefix, ua_type_enum, ua_type = MQTT_IEC_types[ua_type]
- c_loc_name = iec_direction_prefix + iec_size_prefix + locstr + "_" + str(iec_number)
- "type": {"input": LOCATION_VAR_INPUT, "output": LOCATION_VAR_OUTPUT}[direction],
- "size": {"X":1, "B":8, "W":16, "D":32, "L":64}[iec_size_prefix],
- "var_name": c_loc_name,
- "location": iec_size_prefix + ".".join([str(i) for i in current_location]) + "." + str(iec_number),
+ for row in self.modeldata["output"]: + Topic, QoS, _Retained, iec_type, iec_number = row + entries.append((Topic, QoS, iec_type, iec_number, "Q", LOCATION_VAR_OUTPUT)) + for row in self.modeldata["input"]: + Topic, QoS, iec_type, iec_number = row + entries.append((Topic, QoS, iec_type, iec_number, "I", LOCATION_VAR_INPUT)) + for Topic, QoS, iec_type, iec_number, iec_dir_prefix, loc_type in entries: + C_type, iec_size_prefix = MQTT_IEC_types[iec_type] + c_loc_name = "__" + iec_dir_prefix + iec_size_prefix + locstr + "_" + str(iec_number) + "size": {"X":1, "B":8, "W":16, "D":32, "L":64}[iec_size_prefix], + "var_name": c_loc_name, + "location": "%" + iec_dir_prefix + iec_size_prefix + ".".join([str(i) for i in current_location]) + "." + str(iec_number), "type": LOCATION_CONFNODE,
"location": ".".join([str(i) for i in current_location]) + ".x",