# HG changeset patch # User Edouard Tisserant # Date 1725011676 -7200 # Node ID 51272fe96999cb1c37d63aff639ebf4abebaee4b # Parent f30573e986005d392bae2b546e6cf2c0421a5c30 MQTT+IDE: Allow user to associate IEC structure datatype to a topic. diff -r f30573e98600 -r 51272fe96999 dialogs/BrowseLocationsDialog.py --- a/dialogs/BrowseLocationsDialog.py Fri Aug 30 11:50:23 2024 +0200 +++ b/dialogs/BrowseLocationsDialog.py Fri Aug 30 11:54:36 2024 +0200 @@ -134,7 +134,7 @@ self.Controller = controller self.VarType = var_type self.BaseVarType = self.Controller.GetBaseType(self.VarType) - self.VarTypeSize = LOCATION_SIZES[self.BaseVarType] + self.VarTypeSize = LOCATION_SIZES[self.BaseVarType] if self.BaseVarType else None self.Locations = self.Controller.GetVariableLocationTree() # Define Tree item icon list @@ -180,7 +180,7 @@ if self.TypeFilter == 0: return True - if location_size != self.VarTypeSize: + if self.VarTypeSize is not None and location_size != self.VarTypeSize: return False if self.TypeFilter == 1: diff -r f30573e98600 -r 51272fe96999 mqtt/client.py --- a/mqtt/client.py Fri Aug 30 11:50:23 2024 +0200 +++ b/mqtt/client.py Fri Aug 30 11:54:36 2024 +0200 @@ -177,12 +177,12 @@ 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_type, iec_size_prefix = MQTT_IEC_types.get(iec_type,(None,"")) c_loc_name = "__" + iec_dir_prefix + iec_size_prefix + locstr + "_" + str(iec_number) children.append({ "name": Topic, "type": loc_type, - "size": {"X":1, "B":8, "W":16, "D":32, "L":64}[iec_size_prefix], + "size": {"X":1, "B":8, "W":16, "D":32, "L":64, "":None}[iec_size_prefix], "IEC_type": iec_type, "var_name": c_loc_name, "location": "%" + iec_dir_prefix + iec_size_prefix + ".".join([str(i) for i in current_location]) + "." + str(iec_number),