Xiaomi MiWiFi component for tracking devices and managing routers

Yep.
These are available on the resources.
And there are no errors reported when I edit the Lovelace.
What else could I miss?

My card

  1. copy to card manual
  2. modify line 11,55,99
type: vertical-stack
cards:
  - type: vertical-stack
    cards:
      - type: markdown
        content: '#### 5 Ghz'
      - type: 'custom:auto-entities'
        filter:
          include:
            - attributes:
                router_mac: 'XX:XX:XX:XX:XX:XX'
                connection: 5 Ghz
        card:
          type: 'custom:flex-table-card'
          clickable: false
          sort_by: ip+
          columns:
            - data: icon
              name: ' '
              modify: '"<ha-icon id=\"icon\" icon=\"" + x + "\"></ha-icon>"'
            - data: friendly_name
              name: Friendly Name
            - data: ip
              name: IP
              modify: 'x === "0:0:0:0" ? "" : x'
            - data: mac
              name: MAC
            - data: signal
              name: Signal
              modify: 'x === 0 ? "" : x'
            - data: state
              name: State
              modify: 'x === "home" ? "online" : "offline"'
            - data: online
              name: Uptime
              modify: 'x === "0:00:00" ? "" : x'
            - data: last_activity
              name: Last activity
              modify: 'x.replace(/T/i, " ")'
          css:
            table+: 'padding-top: 15px;'
            'tbody tr:nth-child(even)': 'background-color: #a2542f6;'
            td.left: 'padding: 10px 10px 10px 10px'
            th.left: 'padding: 0px 0px 10px 10px; width: 200px'
            'th.left:nth-child(1)': 'width: 44px'
            'th.left:nth-child(2)': 'width: 330px'
  - type: vertical-stack
    cards:
      - type: markdown
        content: '#### 2.4 Ghz'
      - type: 'custom:auto-entities'
        filter:
          include:
            - attributes:
                router_mac: 'XX:XX:XX:XX:XX:XX'
                connection: 2.4 Ghz
        card:
          type: 'custom:flex-table-card'
          clickable: false
          sort_by: ip+
          columns:
            - data: icon
              name: ' '
              modify: '"<ha-icon id=\"icon\" icon=\"" + x + "\"></ha-icon>"'
            - data: friendly_name
              name: Friendly Name
            - data: ip
              name: IP
              modify: 'x === "0:0:0:0" ? "" : x'
            - data: mac
              name: MAC
            - data: signal
              name: Signal
              modify: 'x === 0 ? "" : x'
            - data: state
              name: State
              modify: 'x === "home" ? "online" : "offline"'
            - data: online
              name: Uptime
              modify: 'x === "0:00:00" ? "" : x'
            - data: last_activity
              name: Last activity
              modify: 'x.replace(/T/i, " ")'
          css:
            table+: 'padding-top: 15px;'
            'tbody tr:nth-child(even)': 'background-color: #a2542f6;'
            td.left: 'padding: 10px 10px 10px 10px'
            th.left: 'padding: 0px 0px 10px 10px; width: 200px'
            'th.left:nth-child(1)': 'width: 44px'
            'th.left:nth-child(2)': 'width: 330px'
  - type: vertical-stack
    cards:
      - type: markdown
        content: '#### Lan'
      - type: 'custom:auto-entities'
        filter:
          include:
            - attributes:
                router_mac: 'XX:XX:XX:XX:XX:XX'
                connection: Lan
        card:
          type: 'custom:flex-table-card'
          clickable: false
          sort_by: ip+
          columns:
            - data: icon
              name: ' '
              modify: '"<ha-icon id=\"icon\" icon=\"" + x + "\"></ha-icon>"'
            - data: friendly_name
              name: Friendly Name
            - data: ip
              name: IP
              modify: 'x === "0:0:0:0" ? "" : x'
            - data: mac
              name: MAC
            - data: signal
              name: Signal
              modify: 'x === 0 ? "" : x'
            - data: state
              name: State
              modify: 'x === "home" ? "online" : "offline"'
            - data: online
              name: Uptime
              modify: 'x === "0:00:00" ? "" : x'
            - data: last_activity
              name: Last activity
              modify: 'x.replace(/T/i, " ")'
          css:
            table+: 'padding-top: 15px;'
            'tbody tr:nth-child(even)': 'background-color: #a2542f6;'
            td.left: 'padding: 10px 10px 10px 10px'
            th.left: 'padding: 0px 0px 10px 10px; width: 200px'
            'th.left:nth-child(1)': 'width: 44px'
            'th.left:nth-child(2)': 'width: 330px'

Do you have connected devices in the integration? In what mode does the router work?

@dckiller51 , this is exactly the card I have used (as the GIT), with one exception, removed line 1.
@dmamontov , I have set the MAC of the main router.
My setup is AX6000 as the main unit set as the main DHCP unit, and another AX1800 set as a MESH unit connected with a cable (not wifi).
I do have devices detected in the integration:


Any additional ideas :)?
Thanks for your support.

1 Like

Try to look in the development panel for one of the connected devices “device_tracker.xxx”. What parameters will it have?

@dmamontov, got it to work.
Thank you very much for your help.
It seems like I had to change the MAC address of the connected router.


It seems like the MAC address is different in the mihome application (maybe of the mesh unit?).
Thank you very much for your support.

1 Like

Hi! I successfully added my AX3600 and AX6000. AX9000, instead, is not working.
They are all connected in mesh mode, AX9000 is the parent.
Thanks!

I made this card, if anyone is interested, this is the code:

type: custom:config-template-card
variables:
  - states['sensor.speedtest_download'].state
  - states['sensor.speedtest_upload'].state
  - states['sensor.speedtest_ping'].state
entities:
  - sensor.speedtest_download
  - sensor.speedtest_upload
  - sensor.speedtest_ping
card:
  type: entities
  show_header_toggle: 'off'
  style: |
    .card-header {
      padding: 0px 0px 0px 0px !important;
    }
  entities:
    - type: custom:hui-vertical-stack-card
      cards:
        - type: horizontal-stack
          cards:
            - type: picture
              style: |
                ha-card { 
                    --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                    --ha-card-background: "rgba(0, 0, 0, 0.0)";
                    --ha-card-box-shadow: 'none';
                }
              image: /local/images/ax1800.png
            - type: custom:button-card
              layout: icon_name_state2nd
              show_icon: true
              show_state: true
              styles:
                grid:
                  - grid-template-columns: 50px auto
                icon:
                  - padding: 0px 0px
                  - height: 30px
                  - width: 30px
                card:
                  - '--ha-card-background': rgba(0, 0, 0, 0.0)
                  - '--ha-card-box-shadow': none
                state:
                  - padding: 0px 10px
                  - justify-self: start
                  - font-family: Roboto, sans-serif
                  - font-size: 15px
                name:
                  - padding: 0px 10px
                  - justify-self: start
                  - color: var(--secondary-text-color)
              name: Tempo de atividade
              entity: sensor.ax1800_uptime
              icon: hass:router-wireless
        - type: custom:mini-graph-card
          height: 20
          line_width: 2
          font_size: 70
          hours_to_show: 168
          points_per_hour: 1
          show:
            extrema: true
            fill: true
          style: |
            ha-card { 
              --ha-card-background: "rgba(0, 0, 0, 0.0)";
              --ha-card-box-shadow: 'none';
              border-radius: 5px;
            }
          entities:
            - sensor.ax1800_devices_2_4ghz
          name: 2.4 Ghz
          icon: hass:router-network
          color_thresholds:
            - value: 90
              color: '#3498db'
            - value: 120
              color: '#f39c12'
            - value: 150
              color: '#E45E65'
        - type: custom:mini-graph-card
          height: 20
          line_width: 2
          font_size: 70
          hours_to_show: 168
          points_per_hour: 1
          show:
            extrema: true
            fill: true
          style: |
            ha-card { 
              --ha-card-background: "rgba(0, 0, 0, 0.0)";
              --ha-card-box-shadow: 'none';
              border-radius: 5px;
            }
          entities:
            - sensor.ax1800_devices_5ghz
          name: 5 Ghz
          icon: hass:router-network
          color_thresholds:
            - value: 90
              color: '#3498db'
            - value: 120
              color: '#f39c12'
            - value: 150
              color: '#E45E65'
        - type: custom:mini-graph-card
          height: 20
          line_width: 2
          font_size: 70
          hours_to_show: 168
          points_per_hour: 1
          show:
            extrema: true
            fill: true
          style: |
            ha-card { 
              --ha-card-background: "rgba(0, 0, 0, 0.0)";
              --ha-card-box-shadow: 'none';
              border-radius: 5px;
            }
          entities:
            - sensor.ax1800_memory_usage
          name: Memória usada
          icon: hass:memory
          color_thresholds:
            - value: 20
              color: '#00ff00'
            - value: 40
              color: '#f39c12'
            - value: 50
              color: '#E45E65'
        - type: custom:mini-graph-card
          height: 20
          line_width: 2
          font_size: 70
          hours_to_show: 168
          points_per_hour: 1
          show:
            extrema: true
            fill: true
          style: |
            ha-card { 
              --ha-card-background: "rgba(0, 0, 0, 0.0)";
              --ha-card-box-shadow: 'none';
              border-radius: 5px;
            }
          entities:
            - sensor.speedtest_download
          name: Download
          icon: hass:download
          color_thresholds:
            - value: 100
              color: '#E45E65'
            - value: 150
              color: '#f39c12'
            - value: 300
              color: '#00ff00'
        - type: custom:mini-graph-card
          height: 20
          line_width: 2
          font_size: 70
          hours_to_show: 168
          points_per_hour: 1
          show:
            extrema: true
            fill: true
          style: |
            ha-card { 
              --ha-card-background: "rgba(0, 0, 0, 0.0)";
              --ha-card-box-shadow: 'none';
              border-radius: 5px;
            }
          entities:
            - sensor.speedtest_upload
          name: Upload
          icon: hass:upload
          color_thresholds:
            - value: 50
              color: '#E45E65'
            - value: 90
              color: '#f39c12'
            - value: 100
              color: '#00ff00'
        - type: custom:mini-graph-card
          height: 20
          line_width: 2
          font_size: 70
          hours_to_show: 168
          points_per_hour: 1
          show:
            extrema: true
            fill: true
          style: |
            ha-card { 
              --ha-card-background: "rgba(0, 0, 0, 0.0)";
              --ha-card-box-shadow: 'none';
              border-radius: 5px;
            }
          entities:
            - sensor.speedtest_ping
          name: Ping
          icon: hass:connection
          color_thresholds:
            - value: 10
              color: '#00ff00'
            - value: 20
              color: '#f39c12'
            - value: 40
              color: '#E45E65'
        - type: grid
          cards:
            - type: button
              tap_action:
                action: toggle
              entity: switch.ax1800_reboot
              name: Reiniciar
            - type: button
              tap_action:
                action: toggle
              entity: light.ax1800_led
              show_state: true
          columns: 2
1 Like

Hi guys,

i tried to install it via HACS and configured through the Integration GUI, i put the ip and the password used to login in the admin console of the router, after that it says that the configuration is ok but in the HA Core Logs i’ve found
2021-07-28 11:16:07 WARNING (MainThread) [homeassistant.config_entries] Config entry '192.168.0.1' for miwifi integration not ready yet: None; Retrying in background

and in the integration page the integration is circled in red and says retry configuration: none

any suggestions?
Thanks

Hi everyone,

I’m trying to add Xiaomi Mi Wi-Fi Range Extender Pro V3 R03 ( Model: xiaomi.repeater.v3 ).

device_tracker:
  - platform: xiaomi_miio
    host: 192.168.8.104
    token: TOKEN_FROM_TOKEN_GRABBER

but I’m getting this error.

Error setting up platform legacy xiaomi_miio

3:56:18 AM – (ERROR) Device tracker

Device unavailable or token incorrect: Unable to discover the device 192.168.8.104

3:56:17 AM – (ERROR) Xiaomi Miio

error while reading discover results: Error in path (parsing) -> header parsing expected 8497 but parsed 0

3:56:17 AM – (WARNING) /usr/local/lib/python3.9/site-packages/miio/miioprotocol.py

I know this supports Xioami Mi Wifi Repeater V2 but is it possible to add support to latest Mi Wi-Fi Range Extender Pro?

This is a slightly different integration and it does not support repeaters. You are trying to use the standard one. I think this is in another topic.

Hi Dmitriy

thank you a lot for your effort!
I have a few question here, maybe only clarifications. I have one AX6000 and one R3P device, however, the AX6000 works as AP and R3P as repeater since I am using opnsense as the main router. The integration finds both devices, return their status, led, etc… however, no devices connected. Enabling the force mode, the AX6000 shows devices on Wifi but none at LAN, the same for the R3P.

From the Q&A it looks like that while in force mode the IP address,etc… is not available, however, any idea why the integration do not shows any devices with force mode off? Maybe I have just misread something, just want to make sure everything is set correctly.

thx, tomas

Hi,
I have unusual problem. I have two xiaomi routers working in a mesh mode. They are both supported by this integration. I set up lovelace card from to monitor my devices from here miwifi perfomance table · GitHub
But all my devices have same the ip 127.0.0.1. Maybe I messed up something with my home assistant or my router. I’m not sure.
Can someone help me with this?

Corrected, update to Release v1.2.6 - 2021-11-05 · dmamontov/hass-miwifi · GitHub

1 Like

Great, tnx. It’s working again.

Hi,
I have problem with tracking devices. All devices that are connected to my miwifi router are offline and tracker say that devices are away.
I can’t figure this out. I removed miwifi integration and add it again. When I add again miwifi integration all devices are online and home, but after a while all devices are offline and away.
I use for a long time this configuration.yaml entry with no issues
device_tracker:

  • platform: xiaomi
    host: X.X.X.X.
    password: xxxxxxx
    Home assistant is upgraded to last updates.

and what do you have in the logs when it disappears? and what router? standard integration must be disabled, they conflict, as stated in the repository.

I have Xiaomi AX1800 working in mesh mode with another xiaomi router. They are routers for my local lan. AX1800 is a gateway to cisco rv320 router which is than gateway to two lte routers. I use cisco for load balancing because i have poor internet connection.
I commented out device tracker restareted ha but no luck.
This is what i have in logs:

“AttributeError: ‘DeviceRegistry’ object has no attribute ‘_async_update_device’
2022-02-06 19:20:19 ERROR (MainThread) [homeassistant.helpers.entity] Update for device_tracker.esp_5c2b27 fails
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 512, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 716, in async_device_update
raise exc
File “/config/custom_components/miwifi/device_tracker.py”, line 288, in async_update
await self._update_device(self._config_entry, entry)
File “/config/custom_components/miwifi/device_tracker.py”, line 308, in _update_device
device_registry._async_update_device(
AttributeError: ‘DeviceRegistry’ object has no attribute ‘_async_update_device’
2022-02-06 19:20:19 ERROR (MainThread) [homeassistant.helpers.entity] Update for device_tracker.esp_5bf31e fails
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 512, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 716, in async_device_update
raise exc
File “/config/custom_components/miwifi/device_tracker.py”, line 288, in async_update
await self._update_device(self._config_entry, entry)
File “/config/custom_components/miwifi/device_tracker.py”, line 308, in _update_device
device_registry._async_update_device(
AttributeError: ‘DeviceRegistry’ object has no attribute ‘_async_update_device’
2022-02-06 19:20:19 ERROR (MainThread) [homeassistant.helpers.entity] Update for device_tracker.julia fails
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 512, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 716, in async_device_update
raise exc
File “/config/custom_components/miwifi/device_tracker.py”, line 288, in async_update
await self._update_device(self._config_entry, entry)
File “/config/custom_components/miwifi/device_tracker.py”, line 308, in _update_device
device_registry._async_update_device(
AttributeError: ‘DeviceRegistry’ object has no attribute ‘_async_update_device’
2022-02-06 19:20:19 ERROR (MainThread) [homeassistant.helpers.entity] Update for device_tracker.daniel_a72 fails
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 512, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 716, in async_device_update
raise exc
File “/config/custom_components/miwifi/device_tracker.py”, line 288, in async_update
await self._update_device(self._config_entry, entry)
File “/config/custom_components/miwifi/device_tracker.py”, line 308, in _update_device
device_registry._async_update_device(
AttributeError: ‘DeviceRegistry’ object has no attribute ‘_async_update_device’
2022-02-06 19:20:19 ERROR (MainThread) [homeassistant.helpers.entity] Update for device_tracker.galaxy_s21_5g fails
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 512, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 716, in async_device_update
raise exc
File “/config/custom_components/miwifi/device_tracker.py”, line 288, in async_update
await self._update_device(self._config_entry, entry)
File “/config/custom_components/miwifi/device_tracker.py”, line 308, in _update_device
device_registry._async_update_device(
AttributeError: ‘DeviceRegistry’ object has no attribute ‘_async_update_device’
2022-02-06 19:20:19 ERROR (MainThread) [homeassistant.helpers.entity] Update for device_tracker.f0_e4_a2_45_52_30_2 fails
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 512, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 716, in async_device_update
raise exc
File “/config/custom_components/miwifi/device_tracker.py”, line 288, in async_update
await self._update_device(self._config_entry, entry)
File “/config/custom_components/miwifi/device_tracker.py”, line 308, in _update_device
device_registry._async_update_device(
AttributeError: ‘DeviceRegistry’ object has no attribute ‘_async_update_device’
2022-02-06 19:20:19 ERROR (MainThread) [homeassistant.helpers.entity] Update for device_tracker.esp_15cfdf fails
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 512, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 716, in async_device_update
raise exc
File “/config/custom_components/miwifi/device_tracker.py”, line 288, in async_update
await self._update_device(self._config_entry, entry)
File “/config/custom_components/miwifi/device_tracker.py”, line 308, in _update_device
device_registry._async_update_device(
AttributeError: ‘DeviceRegistry’ object has no attribute ‘_async_update_device’
2022-02-06 19:20:19 ERROR (MainThread) [homeassistant.helpers.entity] Update for device_tracker.esp_578786 fails
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 512, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 716, in async_device_update
raise exc
File “/config/custom_components/miwifi/device_tracker.py”, line 288, in async_update
await self._update_device(self._config_entry, entry)
File “/config/custom_components/miwifi/device_tracker.py”, line 308, in _update_device
device_registry._async_update_device(
AttributeError: ‘DeviceRegistry’ object has no attribute ‘_async_update_device’
2022-02-06 19:20:19 ERROR (MainThread) [homeassistant.helpers.entity] Update for device_tracker.esp_578787 fails
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 512, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 716, in async_device_update
raise exc
File “/config/custom_components/miwifi/device_tracker.py”, line 288, in async_update
await self._update_device(self._config_entry, entry)
File “/config/custom_components/miwifi/device_tracker.py”, line 308, in _update_device
device_registry._async_update_device(
AttributeError: ‘DeviceRegistry’ object has no attribute ‘_async_update_device’”

Thanks, from the logs I see that the logic has changed to hass, I’ll fix it, stay tuned.

Thank you.