mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-09 17:04:29 +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:
|
||||||
if entry['total-memory'] > 0:
|
self.data['resource']['memory-usage'] = round(((entry['total-memory'] - entry['free-memory']) / entry['total-memory']) * 100)
|
||||||
self.data['resource']['memory-usage'] = round(((entry['total-memory'] - entry['free-memory']) / entry['total-memory']) * 100)
|
else:
|
||||||
else:
|
self.data['resource']['memory-usage'] = "unknown"
|
||||||
self.data['resource']['memory-usage'] = "unknown"
|
|
||||||
|
|
||||||
if entry['total-hdd-space'] > 0:
|
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)
|
self.data['resource']['hdd-usage'] = round(((entry['total-hdd-space'] - entry['free-hdd-space']) / entry['total-hdd-space']) * 100)
|
||||||
else:
|
else:
|
||||||
self.data['resource']['hdd-usage'] = "unknown"
|
self.data['resource']['hdd-usage'] = "unknown"
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue