Skip to content

Commit

Permalink
Fix exception 'NoneType' object has no attribute 'log_device_object_p…
Browse files Browse the repository at this point in the history
…roperty'

This can happen if the read for logDeviceObjectProperty fails while building
the TrendLog object. Currently there's a debug message generated, for example:

DEBUG   | Property Access Error for <bacpypes.basetypes.ErrorType object at 0x7f0394564940>

but no other information and the exception stops the controller's points
list from getting populated
  • Loading branch information
gnmerritt committed Feb 2, 2021
1 parent 5d1e520 commit bdc06d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions BAC0/core/devices/Device.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,7 @@ def connect(self, *, db=None):
self.new_state(RPDeviceConnected)

except (NoResponseFromController, AttributeError) as error:
self._log.warning("Error connecting: %s", error)
if self.properties.db_name:
self.new_state(DeviceFromDB)
else:
Expand Down
2 changes: 2 additions & 0 deletions BAC0/core/devices/mixins/read_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ def _find_propid_index(key):
for each in retrieve_type(objList, "trendLog"):
point_address = str(each[1])
tl = TrendLog(point_address, self, read_log_on_creation=False)
if tl.properties.log_device_object_property is None:
continue
ldop_type, ldop_addr = (
tl.properties.log_device_object_property.objectIdentifier
)
Expand Down

0 comments on commit bdc06d0

Please sign in to comment.