diff --git a/pyads/connection.py b/pyads/connection.py index bfe4a55..d6f5ce4 100644 --- a/pyads/connection.py +++ b/pyads/connection.py @@ -598,8 +598,9 @@ def sum_read(port: int, adr: AmsAddr, data_names: List[str], list(structure_defs.keys())) # type: ignore for data_name, structure_def in structure_defs.items(): # type: ignore - result[data_name] = dict_from_bytes(result[data_name], - structure_def) # type: ignore + if data_name in result: + result[data_name] = dict_from_bytes(result[data_name], + structure_def) return result @@ -691,7 +692,7 @@ def write_by_name( return adsSyncWriteByNameEx( self._port, self._adr, data_name, value, plc_datatype, handle=handle ) - + def write_list_by_name( self, data_names_and_values: Dict[str, Any],