mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-23 09:18:46 +02:00
added download and upload rate attributes for queue switches #40
This commit is contained in:
parent
c1c4b41a97
commit
a499d5e9af
3 changed files with 13 additions and 0 deletions
|
@ -740,6 +740,7 @@ class MikrotikControllerData:
|
|||
{"name": ".id"},
|
||||
{"name": "name", "default": "unknown"},
|
||||
{"name": "target", "default": "unknown"},
|
||||
{"name": "rate", "default": "0/0"},
|
||||
{"name": "max-limit", "default": "0/0"},
|
||||
{"name": "limit-at", "default": "0/0"},
|
||||
{"name": "burst-limit", "default": "0/0"},
|
||||
|
@ -769,6 +770,16 @@ class MikrotikControllerData:
|
|||
"download-max-limit"
|
||||
] = f"{round(download_max_limit_bps * uom_div)} {uom_type}"
|
||||
|
||||
upload_rate_bps, download_rate_bps = [
|
||||
int(x) for x in vals["rate"].split("/")
|
||||
]
|
||||
self.data["queue"][uid][
|
||||
"upload-rate"
|
||||
] = f"{round(upload_rate_bps * uom_div)} {uom_type}"
|
||||
self.data["queue"][uid][
|
||||
"download-rate"
|
||||
] = f"{round(download_rate_bps * uom_div)} {uom_type}"
|
||||
|
||||
upload_limit_at_bps, download_limit_at_bps = [
|
||||
int(x) for x in vals["limit-at"].split("/")
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue