diff --git a/README.md b/README.md index 72ad086..3e86260 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Many more Xiaomi and Redmi routers supported by MiWiFi - `xqsystem/login` - Authorization; - `xqsystem/init_info` - Basic information about the router; - `misystem/status` - Basic information about the router. Diagnostic data, memory, temperature, etc; -- `xqnetwork/mode` - Operating mode. Repeater, Access Point, Mesh, etc. +- `xqnetwork/get_netmode` - Operating mode. Repeater, Access Point, Mesh, etc. ##### Additional - `misystem/topo_graph` - Topography, auto discovery does not work without it; diff --git a/custom_components/miwifi/enum.py b/custom_components/miwifi/enum.py index 5c36888..bd791a1 100644 --- a/custom_components/miwifi/enum.py +++ b/custom_components/miwifi/enum.py @@ -43,7 +43,8 @@ def __str__(self) -> str: DEFAULT = 0, "default" REPEATER = 1, "repeater" ACCESS_POINT = 2, "access_point" - MESH = 9, "mesh" + """ netmode:3 """ + MESH = 3, "mesh" class Connection(IntEnum): @@ -254,3 +255,4 @@ def __str__(self) -> str: RB08 = "rb08" # 2022.07.04 R4AV2 = "r4av2" # 2022 CB0401 = "cb0401" # 2022 + RD03 = "rd03" # 2023.12.18 diff --git a/custom_components/miwifi/luci.py b/custom_components/miwifi/luci.py index 8de7070..abc84eb 100644 --- a/custom_components/miwifi/luci.py +++ b/custom_components/miwifi/luci.py @@ -226,13 +226,13 @@ async def new_status(self) -> dict: return await self.get("misystem/newstatus") - async def mode(self) -> dict: - """xqnetwork/mode method. + async def netmode(self) -> dict: + """xqnetwork/get_netmode method. :return dict: dict with api data. """ - return await self.get("xqnetwork/mode") + return await self.get("xqnetwork/get_netmode") async def wifi_ap_signal(self) -> dict: """xqnetwork/wifiap_signal method. diff --git a/custom_components/miwifi/self_check.py b/custom_components/miwifi/self_check.py index 6bcddd5..9202cea 100644 --- a/custom_components/miwifi/self_check.py +++ b/custom_components/miwifi/self_check.py @@ -18,7 +18,7 @@ ("xqsystem/login", "🟢"), ("xqsystem/init_info", "🟢"), ("misystem/status", "status"), - ("xqnetwork/mode", "mode"), + ("xqnetwork/get_netmode", "netmode"), ("xqsystem/vpn_status", "vpn_status"), ("misystem/topo_graph", "topo_graph"), ("xqsystem/check_rom_update", "rom_update"), diff --git a/custom_components/miwifi/updater.py b/custom_components/miwifi/updater.py index 0c25cc6..3e7788d 100644 --- a/custom_components/miwifi/updater.py +++ b/custom_components/miwifi/updater.py @@ -594,11 +594,11 @@ async def _async_prepare_mode(self, data: dict) -> None: if data.get(ATTR_SENSOR_MODE, Mode.DEFAULT) == Mode.MESH: return - response: dict = await self.luci.mode() + response: dict = await self.luci.netmode() - if "mode" in response: + if "netmode" in response: with contextlib.suppress(ValueError): - data[ATTR_SENSOR_MODE] = Mode(int(response["mode"])) + data[ATTR_SENSOR_MODE] = Mode(int(response["netmode"])) return