Skip to content

Commit

Permalink
fix(fritz): value assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgiga1993 committed Sep 29, 2024
1 parent 06d1cba commit d739740
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pollect/sources/FritzSource.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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
Expand Down

0 comments on commit d739740

Please sign in to comment.