Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transform 5ghz2 -> 6ghz for known models #426

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
"tx_speed": 0.0,
}

# Get the model if available
model = kwargs.get("model", None)

Check warning on line 57 in asusrouter/modules/data_transform.py

View check run for this annotation

Codecov / codecov/patch

asusrouter/modules/data_transform.py#L57

Added line #L57 was not covered by tests

# 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 (

Check warning on line 65 in asusrouter/modules/data_transform.py

View check run for this annotation

Codecov / codecov/patch

asusrouter/modules/data_transform.py#L65

Added line #L65 was not covered by tests
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