-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyError exception when reading 'all' properties with show_property_name=True #490
Comments
I was facing the same issue, but I found a workaround. In version 23.7.3 the regarding code snippet is if show_property_name:
try:
int(
propertyIdentifier
) # else it will be a name like maxMaster
prop_id = "@prop_{}".format(propertyIdentifier)
_obj, _id = apdu.listOfReadAccessResults[
0
].objectIdentifier
_key = (str(_obj), vendor_id)
if _key in registered_object_types.keys():
_classname = registered_object_types[_key].__name__
for k, v in registered_object_types["BAC0"][
_classname
].items():
if v["obj_id"] == propertyIdentifier:
prop_id = (k, propertyIdentifier) # type: ignore
if isinstance(value, dict):
value = list(value.items())[0][1]
except ValueError:
prop_id = propertyIdentifier
values.append((value, prop_id))
dict_values[objectIdentifier].append(
(_prop_id, (value, prop_id))
)
else:
values.append(value)
dict_values[objectIdentifier].append((_prop_id, value)) The try is only successful, if the property is a proprietary one and is identified by a number instead of a name. So then the problem causing line is reached. I am not really sure what the rest of the code does or should do, but compared to the except block, which is executed if the property is a known one (e. g. maxMaster), we basicly just have to define the
That is also very similar to the current version 2024.09.20. Here the equvilent code is if show_property_name:
values.append((property_value, property_identifier))
dict_values[str(object_identifier)].append(
(property_identifier, (property_value, property_identifier))
)
else:
values.append(property_value)
dict_values[str(object_identifier)].append(
(property_identifier, property_value)
) |
I'll have a look eventually. Thanks for your patience. |
When I'm doing the following request go read all the properties of an object instance :
I get a
KeyError
exception :If i do instead
I get the list of properties with their values
The text was updated successfully, but these errors were encountered: