mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-27 03:08:59 +02:00
removed unnecessary cycle from system resources
This commit is contained in:
parent
6d394a06ef
commit
25a30b4dc5
1 changed files with 8 additions and 9 deletions
|
@ -421,16 +421,15 @@ class MikrotikControllerData():
|
|||
]
|
||||
)
|
||||
|
||||
for entry in data['resource']:
|
||||
if entry['total-memory'] > 0:
|
||||
self.data['resource']['memory-usage'] = round(((entry['total-memory'] - entry['free-memory']) / entry['total-memory']) * 100)
|
||||
else:
|
||||
self.data['resource']['memory-usage'] = "unknown"
|
||||
if entry['total-memory'] > 0:
|
||||
self.data['resource']['memory-usage'] = round(((entry['total-memory'] - entry['free-memory']) / entry['total-memory']) * 100)
|
||||
else:
|
||||
self.data['resource']['memory-usage'] = "unknown"
|
||||
|
||||
if entry['total-hdd-space'] > 0:
|
||||
self.data['resource']['hdd-usage'] = round(((entry['total-hdd-space'] - entry['free-hdd-space']) / entry['total-hdd-space']) * 100)
|
||||
else:
|
||||
self.data['resource']['hdd-usage'] = "unknown"
|
||||
if entry['total-hdd-space'] > 0:
|
||||
self.data['resource']['hdd-usage'] = round(((entry['total-hdd-space'] - entry['free-hdd-space']) / entry['total-hdd-space']) * 100)
|
||||
else:
|
||||
self.data['resource']['hdd-usage'] = "unknown"
|
||||
|
||||
return
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue