diff --git a/pyads/symbol.py b/pyads/symbol.py index 18590c5..76da02b 100644 --- a/pyads/symbol.py +++ b/pyads/symbol.py @@ -252,10 +252,10 @@ def add_device_notification( """ if attr is None: - if self.plc_type is not None: - attr = NotificationAttrib(length=sizeof(self.plc_type)) - elif self.structure_def is not None: + if self.structure_def is not None: attr = NotificationAttrib(length=self._structure_size) + else: + attr = NotificationAttrib(length=sizeof(self.plc_type)) handles = self._plc.add_device_notification( (self.index_group, self.index_offset), attr, callback, user_handle