diff --git a/custom_components/mikrotik_router/mikrotik_controller.py b/custom_components/mikrotik_router/mikrotik_controller.py index 4d1a154..c01438d 100644 --- a/custom_components/mikrotik_router/mikrotik_controller.py +++ b/custom_components/mikrotik_router/mikrotik_controller.py @@ -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("/") ] diff --git a/custom_components/mikrotik_router/switch.py b/custom_components/mikrotik_router/switch.py index caf0916..6fb1dde 100644 --- a/custom_components/mikrotik_router/switch.py +++ b/custom_components/mikrotik_router/switch.py @@ -44,6 +44,8 @@ DEVICE_ATTRIBUTES_SCRIPT = [ DEVICE_ATTRIBUTES_QUEUE = [ "target", + "download-rate", + "upload-rate", "download-max-limit", "upload-max-limit", "upload-limit-at", diff --git a/docs/assets/images/ui/queue_switch.png b/docs/assets/images/ui/queue_switch.png index d4b84c4..95ca800 100644 Binary files a/docs/assets/images/ui/queue_switch.png and b/docs/assets/images/ui/queue_switch.png differ