Skip to content

Commit

Permalink
Transform 5ghz2 -> 6ghz for known models (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaskivskyi authored Dec 21, 2023
1 parent 99d32b2 commit 64d41ba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions asusrouter/asusrouter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
14 changes: 13 additions & 1 deletion asusrouter/modules/data_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

Expand Down Expand Up @@ -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")

Expand Down

0 comments on commit 64d41ba

Please sign in to comment.