Mi Air Purifier 2: Unable to discover device

Today I got an Air Purifier 2 and the fan is not recognized by HA 0.69.0.

I have extracted the token from iOS-Backup.

HA log:

2018-05-15 20:44:45 ERROR (SyncWorker_4) [miio.device] Unable to discover a device at address XXX.XXX.XXX.XXX
2018-05-15 20:44:45 ERROR (MainThread) [homeassistant.components.fan.xiaomi_miio] Got exception while fetching the state: Unable to discover the device XXX.XXX.XXX.XXX

From command line:

/opt/homeassistant/bin/mirobo --ip XXX.XXX.XXX.XXX --token XXXXXXXXXX --debug
INFO:miio.vacuum_cli:Debug mode active
DEBUG:miio.vacuum_cli:Connecting to XXX.XXX.XXX.XXX with token XXXXXXXXXX
ERROR:miio.device:Unable to discover a device at address XXX.XXX.XXX.XXX
DEBUG:miio.click_common:Exception: Unable to discover the device XXX.XXX.XXX.XXX
Traceback (most recent call last):
File “/opt/homeassistant/lib/python3.6/site-packages/miio/click_common.py”, line 47, in call
return self.main(*args, **kwargs)
File “/opt/homeassistant/lib/python3.6/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/opt/homeassistant/lib/python3.6/site-packages/click/core.py”, line 1043, in invoke
return Command.invoke(self, ctx)
File “/opt/homeassistant/lib/python3.6/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/opt/homeassistant/lib/python3.6/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/opt/homeassistant/lib/python3.6/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/opt/homeassistant/lib/python3.6/site-packages/miio/vacuum_cli.py”, line 68, in cli
File “/opt/homeassistant/lib/python3.6/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/opt/homeassistant/lib/python3.6/site-packages/click/decorators.py”, line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File “/opt/homeassistant/lib/python3.6/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/opt/homeassistant/lib/python3.6/site-packages/miio/vacuum_cli.py”, line 104, in status
res = vac.status()
File “/opt/homeassistant/lib/python3.6/site-packages/miio/vacuum.py”, line 108, in status
return VacuumStatus(self.send(“get_status”)[0])
File “/opt/homeassistant/lib/python3.6/site-packages/miio/device.py”, line 225, in send
File “/opt/homeassistant/lib/python3.6/site-packages/miio/device.py”, line 163, in do_discover
raise DeviceException(“Unable to discover the device %s” % self.ip)
miio.device.DeviceException: Unable to discover the device XXX.XXX.XXX.XXX
Error: Unable to discover the device XXX.XXX.XXX.XXX

My vacuum works fine, but the purifier…

I have 3 of them and they all work just fine, make sure you got the token right and the IP is correct as well. Always good to double check.

here is how I defined 1 of mine:

  - platform: xiaomi_miio
    name: Den Air Purifier
    token: !secret den_purifier_token

Mine is the same config like yours.

IP is right, token should also be right. Purifier is pingable from HA host.

My robot works without any problems, but a new device does not. :frowning:

File a bug in github after you double check everything, maybe the token is wrong?

Tried again, reseted the purifier, got a new token…same behavior. :frowning:

Maybe Xiaomi changed something in the firmware? My version is 1.2.4_60.

I have the same firmware

Today I got another one and it also doesn´t work. :frowning:

I´m wondering about one has firmware 1.2.4_60 and the other one has 1.2.9_60 and both are on the latest version??!?

all 3 of mine work

1 is on 1.2.4_60
2 is on 1.2.9_61

yea those versions don’t make sense to me either lol

I made a tcpdump and the purifiers are not responding, the vacuum does. Firewall rules are the same like the vacuum. Firewall temporary set to any<->any is the same.

Is there a difference to get the token for the purifiers? I made it the same way like for the vacuum. Double checked also the token from the vacuum and it is right.

Your issue sounds like its more network related. Try to turn all that off and give open access and see if it works. Vacuum and Air Purifier may not behave the same under firewalls. I would set them up before doing any network configuration on them.

Did you find a working solution? I’m faceing the same problem as yours

Hello komw,

I have a Xiaomi Air Purifier Pro and I’m having this problem too, sometimes I unplugged the power and connect it again to power it can connect to the wifi, but after a random time (sometimes 30min , sometimes a few hours) the error happens.
Did you find the root cause?

Best regards,