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

Add new device RD03 #161

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion custom_components/miwifi/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -254,3 +255,4 @@ def __str__(self) -> str:
RB08 = "rb08" # 2022.07.04
R4AV2 = "r4av2" # 2022
CB0401 = "cb0401" # 2022
RD03 = "rd03" # 2023.12.18
6 changes: 3 additions & 3 deletions custom_components/miwifi/luci.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion custom_components/miwifi/self_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
6 changes: 3 additions & 3 deletions custom_components/miwifi/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down