From e8324cda6da3ef52075266a0c2358d5da9f8f05f Mon Sep 17 00:00:00 2001 From: Yevhenii Vaskivskyi Date: Thu, 21 Dec 2023 07:17:25 +0100 Subject: [PATCH] Transform `5ghz2 -> 6ghz` for known models --- asusrouter/asusrouter.py | 1 + asusrouter/modules/data_transform.py | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/asusrouter/asusrouter.py b/asusrouter/asusrouter.py index e651297..5de0333 100644 --- a/asusrouter/asusrouter.py +++ b/asusrouter/asusrouter.py @@ -472,6 +472,7 @@ def _transform_data(self, datatype: AsusData, data: Any) -> Any: data, self._identity.services if self._identity else [], self._state.get(AsusData.NETWORK), + model=self._identity.model if self._identity else None, ) if datatype == AsusData.WAN: diff --git a/asusrouter/modules/data_transform.py b/asusrouter/modules/data_transform.py index c5d0bca..eec56f4 100644 --- a/asusrouter/modules/data_transform.py +++ b/asusrouter/modules/data_transform.py @@ -8,11 +8,18 @@ from asusrouter.modules.data import AsusDataState from asusrouter.tools.readers import readable_mac +# List of models with 6Ghz support +# and no 5Ghz2 support +MODEL_WITH_6GHZ = [ + "RT-AXE95Q", +] + def transform_network( data: dict[str, Any], services: Optional[list[str]], history: Optional[AsusDataState], + **kwargs: Any, ) -> dict[str, Any]: """Transform network data.""" @@ -46,13 +53,18 @@ def transform_network( "tx_speed": 0.0, } + # Get the model if available + model = kwargs.get("model", None) + # Check if we have 5GHz2 available in the network data if "5ghz2" in network: # Check interfaces for 5Ghz2/6Ghz support_5ghz2 = "5G-2" in services support_6ghz = "wifi6e" in services - if support_5ghz2 is False and support_6ghz is True: + if ( + support_5ghz2 is False and support_6ghz is True + ) or model in MODEL_WITH_6GHZ: # Rename 5Ghz2 to 6Ghz network["6ghz"] = network.pop("5ghz2")