Xiaomi MiWiFi component for tracking devices and managing routers

I decided to share a component that I have been using for a long time.


Better descriptions can only be questions and answers:

Q. Do I need to get telnet or ssh?

A. Not. integration works through Luci-API

Q. How often are states updated?

A. Once every 10 seconds. This is the most optimal time for correct work.

Q. In addition to tracking devices, what else does the integration allow you to do?

A. The integration creates sensors to track the number of connected devices through different types of connections (5 Ghz, 2.4 Ghz, lan, guest). Creates binary sensors that track (mode, wifi state, wan state). Creates switches to control LEDs and reboot the router. It also collects statistics on connected devices (Signal, Uptime, etc.)

Q. Does the integration support legacy device tracking via known_devices.yaml?

A. This is a legacy device tracking option. But the integration allows importing names, dev_id, icon from the file known_devices.yaml and associating with new devices by mac-address. To do this, simply create or rename the file to legacy_known_devices.yaml

Q. Does the integration support routers connected in repeater mode or access point mode?

A. Yes, the integration supports devices connected in repeater mode or access point mode. But to get the number of devices and their tracking, you will also need to connect and configure the parent router.

Q. Can I use the router in repeater mode or access point mode without a parent MiWiFi device?

A. It is possible with the force_load_repeater_devices option enabled. But there is a limitation. You will not see IP, uptime, and connection type, but the name will be the mac-address.

Q. Does Mesh support routers?

A. Yes, they are supported.

Q. Is a reboot required after changing the [PRO] settings?

A. Reboot is required


Link to component:

P.S.
I will ask everyone who installs themselves and your router is not in the list of supported ones, tell me if it works. Thank you in advance.

3 Likes

Hi @dmamontov. First of all thank You for sharing your component.

My feedback:

I’ve integrated component to my setup with ax3600 global version (FW 3.0.22) and AX1800 (global,; FW 3.0.34)

AX3600 was added as device, but integration has no entties
AX1800 was added without device and entitties

Do You think that is firmware related problem?

Best regards!

Have you reloaded hass? if yes enable debug mode and restart. on the logs it will be clear what the matter is.

logger:
  default: error
  logs:
    ...
    custom_components.miwifi: debug

Debag will help you understand what’s the matter

Yes i reloaded HA (few times)

In logs i have:

I am fairy new in HA so need some time to add properlly logger;).

Update the integration. Fixed this error

When I added logger i have also:

Update the integration v1.0.1. Fixed this error

Updated, restarted - everything works now.

Awsome - thank You Very much!

1 Like

Hi there!
I’ve got a Xiaomi Router HD and it’s not working.
Some logs:

2021-03-12 11:49:13 DEBUG (MainThread) [custom_components.miwifi.core.luci_data] MiWiFi Incorrect config (192.168.0.111) KeyError('model')

Update the component. Fixed, should fix the problem. There is no way to test it on your router. His api is old enough. If there are more errors, write to me in my telegram @dslonyara, I will try to solve it in real time.

Thanks @dmamontov, i’m using v1.0.1
I don’t know how to add you in telegram

Upgrade to 1.0.2.

Thanks to everyone who helps to test on new routers)

2 Likes

Hello l am having Redmi AC 2100 white router. 2.0.23 CN
No device, no entities created.
Edit: Rebooted router. Working now.
Performance table working. Need to put Router Mac manually.
Thank you for sharing @dmamontov

1 Like

Hello, I have this error, and integration not working for me, say: Invalid IP

Logger: homeassistant.setup
Source: custom_components/miwifi/__init__.py:45
First occurred: 7:51:17 (1 occurrences)
Last logged: 7:51:17

Error during setup of component miwifi
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 213, in _async_setup_component
    result = await task
  File "/config/custom_components/miwifi/__init__.py", line 45, in async_setup
    hass.data[DOMAIN][router[CONF_IP_ADDRESS]] = router
KeyError: 'miwifi'

Are you configuring via yml or frontend? The Invalid IP error is called when there is no way to reach the given ip, it can be connection timeout, etc. try restarting your router. Specify which router model?
I recommend configuring it through the interface instead of yml

Fixed the error. Update to 1.0.7

1 Like

Hi,

I confirm that the MiWiFi component works for my Global AX3600 set up as wired extender. One exception though: the list of devices is totally empty, whereas on the Android app I can see all my devices.

I tried using the API directly from a web browser and I got the answer {"mac":"XX:XX:XX:XX:XX:XX","list":[],"code":0}, which confirms that the issue is not in the Home Assistant component.

Does the Android app use a different API?

try it

Q. Can I use the router in repeater mode or access point mode without a parent MiWiFi device?

A. It is possible with the force_load_repeater_devices option enabled. But there is a limitation. You will not see IP, uptime, and connection type, but the name will be the mac-address.

It is advisable to restart after

Sorry, forgot to say that I had already seen this and tried it. I didn’t see any difference (and I still saw the uptime!)

Edit to add: I tried the option in the GUI (Forced booting of devices in repeater mode [PRO]). Can you please confirm it is the same thing as force_load_repeater_devices?

Just tried it again and now it works :smiley:

This time I restarted both the router and Home Assistant. Maybe that is what did the trick.

Edited again to add: uptime still displayed correctly.