From c7c58fa08a79015342e3f9907a7414560f51138e Mon Sep 17 00:00:00 2001 From: Ivan Pavlina Date: Thu, 20 Jan 2022 20:51:45 +0100 Subject: [PATCH] Removing duplicated methods --- .../mikrotik_router/mikrotik_controller.py | 52 ------------------- 1 file changed, 52 deletions(-) diff --git a/custom_components/mikrotik_router/mikrotik_controller.py b/custom_components/mikrotik_router/mikrotik_controller.py index 458b9b3..9b74e1c 100644 --- a/custom_components/mikrotik_router/mikrotik_controller.py +++ b/custom_components/mikrotik_router/mikrotik_controller.py @@ -2135,55 +2135,3 @@ class MikrotikControllerData: delta_rx / time_diff * uom_div, 2 ) self.data["client_traffic"][uid]["previous-bytes-down"] = current_rx - - # --------------------------- - # _get_unit_of_measurement - # --------------------------- - def _get_unit_of_measurement(self): - uom_type = self.option_unit_of_measurement - if uom_type == "Kbps": - uom_div = 0.001 - elif uom_type == "Mbps": - uom_div = 0.000001 - elif uom_type == "B/s": - uom_div = 0.125 - elif uom_type == "KB/s": - uom_div = 0.000125 - elif uom_type == "MB/s": - uom_div = 0.000000125 - else: - uom_type = "bps" - uom_div = 1 - return uom_type, uom_div - - # --------------------------- - # _address_part_of_local_network - # --------------------------- - def _address_part_of_local_network(self, address): - address = ip_address(address) - for vals in self.data["dhcp-network"].values(): - if address in vals["IPv4Network"]: - return True - return False - - # --------------------------- - # _get_accounting_uid_by_ip - # --------------------------- - def _get_accounting_uid_by_ip(self, requested_ip): - for mac, vals in self.data["client_traffic"].items(): - if vals.get("address") is requested_ip: - return mac - return None - - # --------------------------- - # _get_iface_from_entry - # --------------------------- - def _get_iface_from_entry(self, entry): - """Get interface default-name using name from interface dict""" - uid = None - for ifacename in self.data["interface"]: - if self.data["interface"][ifacename]["name"] == entry["interface"]: - uid = ifacename - break - - return uid