diff --git a/pollect/sources/FritzSource.py b/pollect/sources/FritzSource.py index de81dbe..9dcc760 100644 --- a/pollect/sources/FritzSource.py +++ b/pollect/sources/FritzSource.py @@ -40,15 +40,15 @@ def _probe(self) -> Optional[ValueSet]: if service_name not in connection.services: # Use legacy fallback service_name = 'WANCommonIFC1' + + data = ValueSet() output = connection.call_action(service_name, 'GetTotalBytesReceived') new_data['recv_bytes_sec'] = output['NewTotalBytesReceived'] + data.add(Value(output['NewTotalBytesReceived'], name='recv_bytes')) output = connection.call_action(service_name, 'GetTotalBytesSent') new_data['sent_bytes_sec'] = output['NewTotalBytesSent'] - - data = ValueSet() data.add(Value(output['NewTotalBytesSent'], name='sent_bytes')) - data.add(Value(output['NewTotalBytesReceived'], name='recv_bytes')) # Calculate per-second for key, value in new_data.items(): @@ -57,7 +57,7 @@ def _probe(self) -> Optional[ValueSet]: if self._last_time == 0: # First run continue - + if last_value is not None: time_delta = int(time.time() - self._last_time) value_delta = value - last_value