mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-23 01:08:55 +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": ".id"},
|
||||||
{"name": "name", "default": "unknown"},
|
{"name": "name", "default": "unknown"},
|
||||||
{"name": "target", "default": "unknown"},
|
{"name": "target", "default": "unknown"},
|
||||||
|
{"name": "rate", "default": "0/0"},
|
||||||
{"name": "max-limit", "default": "0/0"},
|
{"name": "max-limit", "default": "0/0"},
|
||||||
{"name": "limit-at", "default": "0/0"},
|
{"name": "limit-at", "default": "0/0"},
|
||||||
{"name": "burst-limit", "default": "0/0"},
|
{"name": "burst-limit", "default": "0/0"},
|
||||||
|
@ -769,6 +770,16 @@ class MikrotikControllerData:
|
||||||
"download-max-limit"
|
"download-max-limit"
|
||||||
] = f"{round(download_max_limit_bps * uom_div)} {uom_type}"
|
] = 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 = [
|
upload_limit_at_bps, download_limit_at_bps = [
|
||||||
int(x) for x in vals["limit-at"].split("/")
|
int(x) for x in vals["limit-at"].split("/")
|
||||||
]
|
]
|
||||||
|
|
|
@ -44,6 +44,8 @@ DEVICE_ATTRIBUTES_SCRIPT = [
|
||||||
|
|
||||||
DEVICE_ATTRIBUTES_QUEUE = [
|
DEVICE_ATTRIBUTES_QUEUE = [
|
||||||
"target",
|
"target",
|
||||||
|
"download-rate",
|
||||||
|
"upload-rate",
|
||||||
"download-max-limit",
|
"download-max-limit",
|
||||||
"upload-max-limit",
|
"upload-max-limit",
|
||||||
"upload-limit-at",
|
"upload-limit-at",
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 31 KiB |
Loading…
Add table
Add a link
Reference in a new issue