diff --git a/pyads/symbol.py b/pyads/symbol.py index 56939f2..68aed6f 100644 --- a/pyads/symbol.py +++ b/pyads/symbol.py @@ -162,7 +162,14 @@ def _create_symbol_from_info(self) -> None: info = adsGetSymbolInfo(self._plc._port, self._plc._adr, self.name) self.index_group = info.iGroup - self.index_offset = info.iOffs + if self.index_group == 0xF019: + # For function block properties with monitoring = call + # get symbol using handle instead + self.index_group = constants.ADSIGRP_SYM_VALBYHND + self.index_offset = self._plc.get_handle(self.name) + else: + self.index_offset = info.iOffs + if info.comment: self.comment = info.comment @@ -230,6 +237,8 @@ def __repr__(self) -> str: def __del__(self) -> None: """Destructor""" self.clear_device_notifications() + if self.index_group == constants.ADSIGRP_SYM_VALBYHND: + self._plc.release_handle(self.index_offset) def add_device_notification( self,