Xiaomi MiWiFi component for tracking devices and managing routers

Fixed in version https://github.com/dmamontov/hass-miwifi/releases/tag/v1.4.0

Tnx.
I installed it over hacs and its working. Nearly all devices are online, except one sonoff switch. Switch is tasmotized as well as 9 others and its online but integration says its offline. There is nothing in logs and I can control switch without any problems.

  • SOLVED
    There is no problem with a switch.
    Integration is working as it should. No errors in logs.
    Thank you, you really fix the issue.

A beta version of the component has been released with a lot of changes:
If anyone wants to test, I invite)

2 Likes

Nevertheless, I completed version 2.0.4:

:exclamation::exclamation::exclamation: Warning! This is a release 2.0.4. This version is completely incompatible with previous versions. I recommend removing all integrations and then restarting HASS.

:exclamation::exclamation::exclamation: Warning! All objects will have a new entity_id

Changes 2.0.4:

  • The component is completely redesigned under DataUpdateCoordinator
  • Added auto discovery
  • Optimized start and stop (Asynchronous. Start time in HASS is not correct, they count asynchronous too.) - #8
  • All entity_ids are now generated based on mac address - #6
  • Removed customization support from yaml
  • Removed support for legacy known_devices.yaml
  • Services removed
  • Added new objects, such as sensors, etc. (Some of them are automatically disabled)
  • Wifi adapters can now be turned on and off - #13
  • Added new attributes to device_tracker upspeed and downspeed
  • Added search for web interfaces on devices for the ability to navigate from the device. Ports 80 and 443
  • Added automatic manufacturer detection based on mac address
  • Added support for Xiaomi AX9000 (1.0.140(CN)). Thank you @Tsury for the information provided
  • Added support for most MiWifi routers (All that are on the site)
  • Added safe check for unsupported routers documentation
  • Added images to brands - #20
  • Added advanced logging
  • All objects will have a new entity_id
  • Added and passed all validators and conditions for entering the HACS Default
  • There is probably something else, but a lot of time has passed and a lot of work has been done :grin:

For testing, I express my gratitude to @Tsury and @FaserF.

New performance tables:

1 Like

Hi,
I upgraded home assistant to 2022.4. I have miwifi integration. After home assistant update I removed integration and hacs installation and reinstalled everything again. Performance tables are working great but I have problem with miwifi integration. There is no diagnostics like led light on router, reboot etc. Can you please check it.
This is error log on home assistant restart.

Logger: homeassistant.components.binary_sensor
Source: helpers/entity_registry.py:383
Integration: Binary sensor (documentation, issues)
First occurred: 8:52:32 PM (4 occurrences)
Last logged: 8:52:39 PM

Error adding entities for domain binary_sensor with platform miwifi
Error while setting up miwifi platform for binary_sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in _async_add_entity
    entry = entity_registry.async_get_or_create(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 383, in async_get_or_create
    raise ValueError("entity_category must be a valid EntityCategory instance")
ValueError: entity_category must be a valid EntityCategory instance
Logger: homeassistant.components.sensor
Source: helpers/entity_registry.py:383
Integration: Sensor (documentation, issues)
First occurred: 8:52:32 PM (4 occurrences)
Last logged: 8:52:39 PM

Error adding entities for domain sensor with platform miwifi
Error while setting up miwifi platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in _async_add_entity
    entry = entity_registry.async_get_or_create(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 383, in async_get_or_create
    raise ValueError("entity_category must be a valid EntityCategory instance")
ValueError: entity_category must be a valid EntityCategory instance
Logger: homeassistant.components.light
Source: helpers/entity_registry.py:383
Integration: Light (documentation, issues)
First occurred: 8:52:32 PM (4 occurrences)
Last logged: 8:52:39 PM

Error adding entities for domain light with platform miwifi
Error while setting up miwifi platform for light
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in _async_add_entity
    entry = entity_registry.async_get_or_create(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 383, in async_get_or_create
    raise ValueError("entity_category must be a valid EntityCategory instance")
ValueError: entity_category must be a valid EntityCategory instance
Logger: homeassistant.components.button
Source: helpers/entity_registry.py:383
Integration: Button (documentation, issues)
First occurred: 8:52:32 PM (4 occurrences)
Last logged: 8:52:39 PM

Error adding entities for domain button with platform miwifi
Error while setting up miwifi platform for button
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in _async_add_entity
    entry = entity_registry.async_get_or_create(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 383, in async_get_or_create
    raise ValueError("entity_category must be a valid EntityCategory instance")
ValueError: entity_category must be a valid EntityCategory instance
Error adding entities for domain switch with platform miwifi
Error while setting up miwifi platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in _async_add_entity
    entry = entity_registry.async_get_or_create(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 383, in async_get_or_create
    raise ValueError("entity_category must be a valid EntityCategory instance")
ValueError: entity_category must be a valid EntityCategory instance

Thank you @dmamontov for fixing most of the issues in such short notice.
But i have another error. Can you please check it out.

This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/miwifi/helper.py:102
Integration: MiWifi (documentation, issues)
First occurred: 9:18:29 PM (71 occurrences)
Last logged: 10:06:19 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 137, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 268, in _async_refresh
    update_callback()
  File "/config/custom_components/miwifi/device_tracker.py", line 346, in _handle_coordinator_update
    ) > parse_last_activity(self._device.get(ATTR_TRACKER_LAST_ACTIVITY))
  File "/config/custom_components/miwifi/helper.py", line 102, in parse_last_activity
    return datetime.strptime(last_activity, "%Y-%m-%dT%H:%M:%S")
TypeError: strptime() argument 1 must be str, not tuple

Delete and reconnect, I also recommend cleaning the config / .storage / miwifi folder

This is a bug in one of the versions, it has been fixed in the new versions. Her PIP8 autofix added(

I completed version 2.2.0:

  • Fixed a bug when saving settings, now you do not need to restart HASS
  • Increased the default timeout, also added its setting when connecting the device
  • Added the ability to manage a wifi channel (the object is disabled by default) - :exclamation:The change causes the wifi adapter to restart in the router
  • Added the ability to control the strength of the wifi signal (the object is disabled by default) - :exclamation:The change causes the wifi adapter to restart in the router
  • Fixed minor bugs

Changes in v2.3.0

BREAKING CHANGES

  • Added wifi ap signal sensor (Appears only if the router is in this mode)
  • Added speed sensors download and upload wan port

HELPFUL INFORMATION

  • Signal conversion, as in a router: signal >= 80 = Excellent, 80 > signal >= 30 = good, 30 > signal = bad

Changes in v2.3.1

BREAKING CHANGES

  • Added support for Redmi Router AX5(RA50) - #44

Changes in v2.4.0

BREAKING CHANGES

  • Added support for getting diagnostic data. more
  • Added full CodeQL validation

BUGFIXES

  • Fixed late discovery by parent device.
  • Disabled detection of devices without MiWifi in discovery.

Changes in v2.4.1

NEW DEVICE

  • Add support Redmi Router AX6000 (RB06)

New release v2.5.0

BREAKING CHANGES

  • Minimum HASS version increased to 2022.4.0
  • The wifi info method has been changed from xqnetwork/wifi_detail_all to xqnetwork/wifi_diag_detail_all. To fully support guest access
  • Added switch to manage guest network (Disabled by default)
  • Added the ability to work with device firmware updates (You can now update the firmware directly from HASS)
  • DataUpdateCoordinator has been refactored
  • Platform initialization has been refactored
  • Added gluing of devices if one of the devices is connected to another (Only for routers)

BUGFIXES

  • Fixed bug with frequent authorization
  • Fixed blinking device states
  • Fixed loading manufacturers

Telegram

Changes in v2.5.1

BUGFIXES

  • Small bug fixed - #39

Telegram

Changes in v2.5.2

BUGFIXES

  • Fixed minor bugs
  • Fixed error when getting update information on rooted devices - #52
  • Fixed wifi switching bug (requires additional verification on other devices) - #51

HELPFUL INFORMATION

  • I started covering the component with tests and fixing bugs based on them. Don’t be intimidated by the number of updates.

Telegram

Changes in v2.5.3

BUGFIXES

  • Fixed error getting wifi adapter status on some devices - #51

Telegram

Changes in v2.5.4

NEW DEVICE

  • Add support Xiaomi Router AX3200 (RB01)

BUGFIXES

  • Fixed removal of device_tracker
  • Fixed minor bugs

Telegram

Changes in v2.6.0

BREAKING CHANGES

  • DataUpdateCoordinator is 100% covered by tests
  • Refactored the definition of the manufacturer by mac address
  • Wan speed sensors are now displayed in the B/s unit (HASS swears at dynamic ones)
  • Changed the logic of obtaining the image of the router in the update

BUGFIXES

  • With the help of tests, a very large number of errors and shortcomings were corrected. I don’t think it’s worth listing every little thing

Hi there!

Sorry in advance because I’m quite new in HA yet.

It’s my first time with this integration and I’m getting all the time this:


2022-05-08 16:39:46 DEBUG (MainThread) [custom_components.miwifi.luci] Successful request (http://192.168.31.X/cgi-bin/luci/api/xqsystem/login): b'{"code":401,"msg":"not auth"}'
2022-05-08 16:39:46 DEBUG (MainThread) [custom_components.miwifi.luci] Failed to get token (http://192.168.31.X/cgi-bin/luci/api/xqsystem/login): {'code': 401, 'msg': 'not auth'}
2022-05-08 16:39:46 DEBUG (MainThread) [custom_components.miwifi.updater] Finished fetching MiWifi updater data in 1.260 seconds (success: True)
2022-05-08 16:39:46 DEBUG (MainThread) [custom_components.miwifi.config_flow] Verify access code: 403
2022-05-08 16:39:58 DEBUG (MainThread) [custom_components.miwifi.luci] Successful request (http://192.168.31.X/cgi-bin/luci/api/xqsystem/login): b'{"code":401,"msg":"not auth"}'
2022-05-08 16:39:58 DEBUG (MainThread) [custom_components.miwifi.luci] Failed to get token (http://192.168.31.X/cgi-bin/luci/api/xqsystem/login): {'code': 401, 'msg': 'not auth'}
2022-05-08 16:39:58 DEBUG (MainThread) [custom_components.miwifi.updater] Finished fetching MiWifi updater data in 1.227 seconds (success: True)
2022-05-08 16:39:58 DEBUG (MainThread) [custom_components.miwifi.config_flow] Verify access code: 403

Just to clarify, the X is not an actual X haha.

For sure the password is the correct one, I’m able to log in through website and app.

what is happening here?
Am I doing anything wrong?

Thanks!!

@ajgomezd The required password is router login password not wifi password. They are the same when you set router through app but then you can change them. If you have changed wifi pass only the login pass stays the same.