Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor icon indicating copy to clipboard operation
Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor copied to clipboard

Map Extractor quit working (Two factor authentication required)

Open jscherry opened this issue 2 years ago • 117 comments

I've been successfully using the camera, map extractor, etc for over a year. It recently started giving me this error in the logs: This error originated from a custom integration.

Logger: custom_components.xiaomi_cloud_map_extractor.common.xiaomi_cloud_connector Source: custom_components/xiaomi_cloud_map_extractor/common/xiaomi_cloud_connector.py:86 Integration: xiaomi_cloud_map_extractor (documentation, issues) First occurred: 8:45:59 PM (1 occurrences) Last logged: 8:45:59 PM

Additional authentication required. Open following URL using device that has the same public IP, as your Home Assistant instance: https://account.xiaomi.com/identity/authStart?sid=passport&context=uTqPvO6apqW6eNzYVJGlecf1IdPlwCuf7s4kyGgAEEHJu8hAtr6hDE01YlWWNPJ1tlXWDxfLVW-XaF1FEclBzxl-WYSoMPDuPiSGPQu_kJfGzvjZ78EOMaHfXz9STWfcm2RxnfWkPN22ukly0MLQ-Q8YVb7lbyzW9ZiU7GNSlQGFHX1NKVBTa15-omitted last part for security

I pasted this address into a browser and it just came up "TIPS" on xiaomi help site?

Also the lovelace card reads: "two factor authentication required (see logs)" with this below: "Your camera entity is not providing calibration_points Enable calibration_points in camera entity or disable camera_calibration"

I had callibration points in my config so I removed it and am still getting the error and it won't load. Here's the config I'm using: camera: - platform: xiaomi_cloud_map_extractor host: token: username: password:

I'm running

Host Operating System Home Assistant OS 6.1
Update Channel beta
Supervisor Version supervisor-2021.06.8
Docker Version 20.10.6
Disk Total 113.9 GB
Disk Used 23.8 GB
Healthy true
Supported true
Board odroid-n2
Supervisor API ok
Version API ok
Version core-2021.7.2
Installation Type Home Assistant OS
Development false
Supervisor true
Docker true
Virtual Environment false
Python Version 3.9.5
Operating System Family Linux
Operating System Version 5.9.16
CPU Architecture aarch64

Any help would be greatly appreciated. I just enabled info logging for the map extractor and will post the logs after reboot.

jscherry avatar Jul 17 '21 02:07 jscherry

You have to open provided link in your browser and follow steps described on the page. It is possible that your link has expired before you used it. You can use token extractor to generate a new one. You have to do it from a device that is in the same LAN as HA

PiotrMachowski avatar Jul 17 '21 11:07 PiotrMachowski

I experienced exactly the same behavior like @jscherry with our two Roborock S5 Max today: All of a sudden the extracted maps for the vacuums didn't show up anymore with Lovelace but showing the pictures "two factor authentication required (see logs)" instead.

Using token extractor didn't bring up anything new: Nothing has changed but the tokens are exactly the same as they were before.

So I simply just restared Home Assistant and all went automagically back to good again: The maps incl. calibration points, zones etc. are showing again in Lovelace.

I don't know whether the culprit was with Xiaomi or HA.

Tamsy avatar Jul 17 '21 14:07 Tamsy

I just experienced the exact same thing as the OP. I suspect Xiaomi is adding some sort of MFA to their servers. However, I noticed that my ISP's DHCP-issued IP address for my private network had changed between yesterday and today, so I wonder if that might have contributed to the sudden display of the error. A simple restart of HA didn't resolve the issue, but after doing a reboot of both my pfSense server and a physical reboot of my HA VM, it started working again.

MadOtis avatar Jul 22 '21 16:07 MadOtis

For me The Problem exists on a per day Basis :/

mkrasselt1 avatar Sep 21 '21 11:09 mkrasselt1

I'm having the same issue since my HA instance froze yesterday. When trying to use token extractor to get the token. I get the exact same message. But I can log in to my Xiaomi Cloud account on the website without 2FA.

Edit: So I found this: After I reboot my HA instance and directly go to the logs, the same error message turns up. But if you open the link within like a minute or so, you actually get the option to do 2FA. However after I do that, it nicely shows "ok" on the site, but the map extractor is still not working.

Edit 2: Oh and reinstalling the map extractor doesn't make a difference either

Please assist.

dbloom86 avatar Oct 12 '21 06:10 dbloom86

@dbloom86 Have you opened the links using a device that has the same public IP as your HA instance?

PiotrMachowski avatar Oct 12 '21 08:10 PiotrMachowski

@PiotrMachowski yes I have. Like I said, I can do the 2FA authentication just fine. It just doesn't change the fact that the integration keeps coming back with the message and it doesn't show a map

dbloom86 avatar Oct 12 '21 08:10 dbloom86

@dbloom86 try to follow these steps:

  1. Reload Xiaomi Cloud Map Extractor domain (to get a fresh 2FA link)
  2. Complete 2FA flow using device that has the same public IP as your HA instance
  3. Reload Xiaomi Cloud Map Extractor again

PiotrMachowski avatar Oct 12 '21 08:10 PiotrMachowski

@PiotrMachowski Ok I tried that. But it just keeps generating the error and not showing the map. Every time I reload the Xiaomi Cloud Map Extractor, the error shows up and I get a new 2FA link. I can complete it over and over again, but to no avail unfortunately.... Any other Ideas?

Edit: If I use the token extractor tool (Python script thingy) I get the exact same message. Idk what to do anymore :(

dbloom86 avatar Oct 12 '21 08:10 dbloom86

@dbloom86 Can you try using token extractor from a different public IP (e.g. using your phone as a access point)?

PiotrMachowski avatar Oct 12 '21 09:10 PiotrMachowski

@PiotrMachowski I just tried that. But it gives the same exact result. I'm starting to think, it is something in my Xiaomi Cloud account.... But Idk what...

dbloom86 avatar Oct 12 '21 09:10 dbloom86

@dbloom86 do you use other integrations that connect to Xiaomi Cloud?

PiotrMachowski avatar Oct 12 '21 09:10 PiotrMachowski

@PiotrMachowski nope. I do have the Xiaomi Home app on my phone, and that connects fine. But that doesn't use the same way of connecting I think. I can try another integration to test though

dbloom86 avatar Oct 12 '21 10:10 dbloom86

@PiotrMachowski ok this is weird. I installed another integration that was gonna use the Xiaomi Cloud, but I didn't set it up yet. Restarted HA after installing it, and somehow the map extractor started working again. Thanks for all the help though!

dbloom86 avatar Oct 12 '21 10:10 dbloom86

@dbloom86

PiotrMachowski avatar Oct 12 '21 10:10 PiotrMachowski

Is anyone looking at a proper fix for this? Had this issue for a while. First time, restarting did the trick. A couple of weeks later it came back and nothing seems to work. Tried all the things described here😕

adabelleleiram avatar Oct 23 '21 13:10 adabelleleiram

I get the same issue btw when trying to run the python token extractor. It gives me a link saying two factor authentication required. When I go to the link, I'm able to fill in the number I get in the email but nothing happens in the script. Restarting it gives me the same error

adabelleleiram avatar Oct 24 '21 09:10 adabelleleiram

I noticed this happening if my vaccum was in another subnet then my phone/homeassitant - but sharing the same public ip adress, maybee this helps some of you guys :) (And notice: I logged out of all my mobile apps during the extraction process, and logged back in later - not shure if this affected my setup)

mkrasselt1 avatar Oct 27 '21 08:10 mkrasselt1

I can confirm the above.. if you open the link from the same subnet it works. However, my problem is that i simply do not receive the email...

almostserious avatar Nov 02 '21 10:11 almostserious

@almostserious it's possible that link has expired, try to reload Extractor domain in Server Controls and use the new link

PiotrMachowski avatar Nov 02 '21 12:11 PiotrMachowski

Thanks, the link is still fine. Its an issue with the Xiaomi Email.. I'm stuck in a loop now ;) Don't have a phone number connected to receive a code, and to register the phone number I first need to confirm the email which doesn't work ;) Lets see if it maybe arrives 24h later.

almostserious avatar Nov 02 '21 13:11 almostserious

@PiotrMachowski I'm with the same problem. From couple days ago the map it's STOP working.

the card shows: "two factor auth required (see logs)" I restart HA and in logs Additional authentication required. Open following URL using device that has the same public IP, as your Home Assistant instance: https://account.xiaomi.com/ident... sometimes the page only shows Mi logo and Tips but nothing more, othertimes I can get the login page fill the form receive the code to my email and the page shows "ok" in left upper corner"

in my mi account in 2 step auth menu it's disable...

kikofhm avatar Nov 05 '21 08:11 kikofhm

You have to open provided link in your browser and follow steps described on the page. It is possible that your link has expired before you used it. You can use token extractor to generate a new one. You have to do it from a device that is in the same LAN as HA

Just came here to say that this worked for me. It must be like a "random" or "rare" check of the Xiaomi API to verify that the logins are not a hack attempt and that they originate from the true owner of the account. What I am about to say is not salt to any of the other users facing problems but make sure you have the right requirements in place people.

Firstly and I can't stress this enough, try this from the browser, on a PC that is on the same network as your HA instance. Not from your friend's PC, not from your mobile (on cellular network) phone browser, not from a incognito window, not anything fancy. Just a simple browser window on a pc on the same network as your Home Assistant.

Secondly. Xiaomi will ask for a verification (either email or phone). Don't treat your Xiaomi Accounts like garbage accounts that you created to join a giveaway. Ensure that your phone and email are in there and that you have actual access to these data.

Thirdly. Go to HA > Configuration > Server Controls and reload XIAOMI_CLOUD_MAP_EXTRACTOR after you are done. Then give it a couple of minutes.

gsotiriou avatar Nov 06 '21 13:11 gsotiriou

Tried all of the above. Tried to enable/disable the request of 2fa from other devices. Tried via token link and HA link. Tried another public IP (via phone internet connection) Still, unfortunately, stuck in the same loop.

Fannangir avatar Nov 09 '21 16:11 Fannangir

You have to open provided link in your browser and follow steps described on the page. It is possible that your link has expired before you used it. You can use token extractor to generate a new one. You have to do it from a device that is in the same LAN as HA

Just came here to say that this worked for me. It must be like a "random" or "rare" check of the Xiaomi API to verify that the logins are not a hack attempt and that they originate from the true owner of the account. What I am about to say is not salt to any of the other users facing problems but make sure you have the right requirements in place people.

Firstly and I can't stress this enough, try this from the browser, on a PC that is on the same network as your HA instance. Not from your friend's PC, not from your mobile (on cellular network) phone browser, not from a incognito window, not anything fancy. Just a simple browser window on a pc on the same network as your Home Assistant.

Secondly. Xiaomi will ask for a verification (either email or phone). Don't treat your Xiaomi Accounts like garbage accounts that you created to join a giveaway. Ensure that your phone and email are in there and that you have actual access to these data.

Thirdly. Go to HA > Configuration > Server Controls and reload XIAOMI_CLOUD_MAP_EXTRACTOR after you are done. Then give it a couple of minutes.

The problem is that, even doing that exact steps (same network, no incognito mode or anything, trying using phone and/or email, getting the "ok" page after and reloading the plugin after) it still will not work.

Maybe it is something related to the mi account itself?

bellini666 avatar Nov 09 '21 16:11 bellini666

Same here. I tried everything mentioned here. But it keeps coming back. Stuck in a loop. Seems to have started with release 2021.11 of HA. Or maybe Xiaomi changed something?

dbloom86 avatar Nov 09 '21 16:11 dbloom86

Restarted HA today following an update to the latest version (2021.11.2). The integration started working, map has appeared. Don't know what would be the reason.

Fannangir avatar Nov 10 '21 15:11 Fannangir

Restarted HA today following an update to the latest version (2021.11.2). The integration started working, map has appeared. Don't know what would be the reason.

For me it hasn't unfortunately. It all seems really random imho

dbloom86 avatar Nov 10 '21 15:11 dbloom86

Restarted HA today following an update to the latest version (2021.11.2). The integration started working, map has appeared. Don't know what would be the reason.

I experienced the same behaviour, since 2021.11.2 and a HA-restart it started working again. just let me know if I can help with data, unfortunately I have no knowledge of developing applications, but maybe delivering data can help too.

steuerzentrale avatar Nov 10 '21 15:11 steuerzentrale

For me too, just restarted HA and it started working just now. Didn't try any 2fa login since 2 days ago.

The only thing I see in the logs now is:

Logger: homeassistant.components.camera
Source: components/camera/__init__.py:488
Integration: Camera (documentation, issues)
First occurred: November 9, 2021, 23:30:51 (2 occurrences)
Last logged: 12:59:15

The camera entity camera.roborock_camera does not support requesting width and height, please open an issue with the integration author

But that is just a warning, map is working fine now

bellini666 avatar Nov 10 '21 16:11 bellini666

Had the same issues since updating to HA 2021.11, tried all suggestions but nothing worked. This morning I update HA to 2021.11.2, and tried reapplying 2FA, but map didn't load. Now I saw above messages, I again reloaded Xiaomi_Cloud_Map_Extractor via server controls, and magically the map is working again!

michelotten avatar Nov 10 '21 16:11 michelotten

I didn't update HA (still on 2021.9.7) but a restart of the integration solved it for me too.

adabelleleiram avatar Nov 10 '21 18:11 adabelleleiram

Restarted HA today following an update to the latest version (2021.11.2). The integration started working, map has appeared. Don't know what would be the reason.

Same here, working with version core-2021.11.2

Glad that it's solved.

diogodias24 avatar Nov 12 '21 17:11 diogodias24

Works on my side. After loading component (HA Core restarted) I quickly copied a link and did 2FA on Xiaomi site. Probably after that I also restarted HA Core once more. Since then everything works fine.

For those still having problems: Make sure that you do 2FA ASAP after loading the component. Also AFAIR, you need to do so from the same network (IP) that HA is hosted on.

fi-sch avatar Nov 16 '21 12:11 fi-sch

Do you need to confirm 2fa every 1 or 2 weeks? I'm facing that ...

marcioibm avatar Mar 02 '22 05:03 marcioibm

Hello. Since I needed 2fa, I only repeated it twice, and all because my external IP changed. Perhaps your IP is also dynamic and also changes once every one or two weeks...

gogenzuller avatar Mar 02 '22 05:03 gogenzuller

Hello. Since I needed 2fa, I only repeated it twice, and all because my external IP changed. Perhaps your IP is also dynamic and also changes once every one or two weeks...

Hmmm that's probably it! Thank you!!

marcioibm avatar Mar 03 '22 15:03 marcioibm

You have to open provided link in your browser and follow steps described on the page. It is possible that your link has expired before you used it. You can use token extractor to generate a new one. You have to do it from a device that is in the same LAN as HA

Just came here to say that this worked for me. It must be like a "random" or "rare" check of the Xiaomi API to verify that the logins are not a hack attempt and that they originate from the true owner of the account. What I am about to say is not salt to any of the other users facing problems but make sure you have the right requirements in place people.

Firstly and I can't stress this enough, try this from the browser, on a PC that is on the same network as your HA instance. Not from your friend's PC, not from your mobile (on cellular network) phone browser, not from a incognito window, not anything fancy. Just a simple browser window on a pc on the same network as your Home Assistant.

Secondly. Xiaomi will ask for a verification (either email or phone). Don't treat your Xiaomi Accounts like garbage accounts that you created to join a giveaway. Ensure that your phone and email are in there and that you have actual access to these data.

Thirdly. Go to HA > Configuration > Server Controls and reload XIAOMI_CLOUD_MAP_EXTRACTOR after you are done. Then give it a couple of minutes.

That worked for me as well. (1) Restart Xiaomi Map Extractor (2) Check logs and follow link (from my PC connected to the same WAN access point as vacuum cleaner) (3) Fill the authentication form (4) Got "ok" from https://sts.api.io.mi.com/sts. (5) Restart HAss as camera has some issues. NOTE the point on mobile phone IP is very good one. It does differ from router's IP.

bialass avatar Mar 24 '22 07:03 bialass

You have to open provided link in your browser and follow steps described on the page. It is possible that your link has expired before you used it. You can use token extractor to generate a new one. You have to do it from a device that is in the same LAN as HA

Just came here to say that this worked for me. It must be like a "random" or "rare" check of the Xiaomi API to verify that the logins are not a hack attempt and that they originate from the true owner of the account. What I am about to say is not salt to any of the other users facing problems but make sure you have the right requirements in place people.

Firstly and I can't stress this enough, try this from the browser, on a PC that is on the same network as your HA instance. Not from your friend's PC, not from your mobile (on cellular network) phone browser, not from a incognito window, not anything fancy. Just a simple browser window on a pc on the same network as your Home Assistant.

Secondly. Xiaomi will ask for a verification (either email or phone). Don't treat your Xiaomi Accounts like garbage accounts that you created to join a giveaway. Ensure that your phone and email are in there and that you have actual access to these data.

Thirdly. Go to HA > Configuration > Server Controls and reload XIAOMI_CLOUD_MAP_EXTRACTOR after you are done. Then give it a couple of minutes.

Just going to HA > Configuration > Server Controls and reloading XIAOMI_CLOUD_MAP_EXTRACTOR did the trick for me

Edit 22/04/2022: It happened again and can't solve it now. Edit 22/04/2022: All of a sudden, after a HA server restart it started working again, without having to touch anything...

T81 avatar Apr 02 '22 20:04 T81

I have added returning 2FA URL in camera's attributes, it should be easier to get it than in logs

PiotrMachowski avatar May 24 '22 00:05 PiotrMachowski

I've tried all the suggestions here and had no luck. I'm running HA inside a VM on a mac mini, and tried opening the 2FA link on the mac mini, same public IP address, and it still continues to ask for additional authentication.

Anyone have any suggestions on what to try?

MiralDesai avatar Jul 01 '22 15:07 MiralDesai

For anyone expericing this issue, check your router settings and bind vaccum to a static IP address, same as the IP set in camera.host.

yzlnew avatar Jul 02 '22 07:07 yzlnew

@yzlnew I'm not sure if it will help, this error is raised before even connecting to the vacuum

PiotrMachowski avatar Jul 02 '22 08:07 PiotrMachowski

Greetings, I'm stuck here as well. I have a viomi se and the map is not showing and asking for 2fa. Did it 3 times and it didn't work, and now I'm rate limited from trying again... Guess I'll have to try again in 1 day... Any ideas or suggestions?

thanasis00 avatar Jul 04 '22 01:07 thanasis00

Same issue here. Additional authentication required. Open following URL using device that has the same public IP, as your Home Assistant instance: "Two factor auth required "

  1. Iam on the same public IP.
  2. Used the token extractor and followed the step with the URL. Got an "OK"message after.
  3. restarted the xiaomi_cloud_map_extractor: Reload service. nothing happens. not even after rebooting HA.

Home Assistant OS 8.2

Arie046 avatar Jul 11 '22 13:07 Arie046

Just an update, my integration started working on its own, without me trying to do the 2fa again. Don't know why this happened, but now I have the map working. Maybe it takes time for some reason?

thanasis00 avatar Jul 11 '22 13:07 thanasis00

i have same problem as https://github.com/PiotrMachowski/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor/issues/157#issuecomment-1180409114

toloomierz avatar Jul 12 '22 10:07 toloomierz

Yes, my integration asked for 2fa and map stopped working. I tried to re-authenticate on Xiaomi cloud, restarted HA several times, but no luck, and then several days after, it start working again after a restart made by another purpose not related.

adocampo avatar Jul 12 '22 15:07 adocampo

I've tried all the suggestions here and had no luck. I'm running HA inside a VM on a mac mini, and tried opening the 2FA link on the mac mini, same public IP address, and it still continues to ask for additional authentication.

Anyone have any suggestions on what to try?

@MiralDesai hi, any luck on this problem?

I run Hassos in a VM and my VM has not the same IP as my MacMini even thought they are on the same local network.

I have tryed to run the link in my browser but this is from my MacMinis local IP. How can i run this code from my Hassos VM to get the right auth IP?

Have a nice day :)

digitalit avatar Jul 17 '22 11:07 digitalit

I can't get the 2FA stuff to work either. All the suggestions aren't helping.

I already had to somewhat hack around the fact that the token extractor has the same issue. There I had to manually change the python file for the token extractor with some values that came back from the URL via the Network tab of my browser. The extractor then worked and I managed to get the token, which did in fact get me to link Home Assistant to my vacuum.

However, the map extractor has the same issue and here I'm not sure if that can be worked around the same way. I haven't looked into it, but it should also not be required.

To be clear, the Laptop and my PI sit on the same Network. Same Public IP (otherwise I wouldn't be able to get the Token). The settings in the configuration file are basically copy-pasted and the secrets file has the token that got extracted, as well as the xiaomi email, and password, and finally the IP of the vacuum, all of which I basically already used to add the vacuum to HA in the first place.

Would be awesome if this could get an official fix somehow. (:

eXifreXi avatar Jul 17 '22 22:07 eXifreXi

Same issue here. Unfortunately I can't get it working using any of the suggested fixes.

It stopped working after updating home assistant, so something must have changed on their end bugging things out here.

barrelltitor avatar Jul 22 '22 00:07 barrelltitor

Same issue here. I think because my internet provider randomly changes my ip address.

Anyone found a way to bypass or disable or bypass this 2FA challenge? As you know, I cant change my provider rules or change provider, so if we can not find a solutions for it, component will be unusable for many people.

@PiotrMachowski Please reopen the issue.

alexandre-leites avatar Jul 22 '22 21:07 alexandre-leites

Unfortunately have to join in on this:

  • stopped working ~1,5 weeks ago without any updates/changes in an untouched system
  • worked through all suggested fixes (2FA reauth , same IP, core restart, hard reboot, waiting a few days, ...) without success
  • Mi account doesn't give any option to disable/engage 2FA; standard control of robot does work without problems; HA system and add-ons/components all up to date Any help would be highly appreciated!

meyerjh2001 avatar Jul 22 '22 21:07 meyerjh2001

Unfortunately have to join in on this:

  • stopped working ~1,5 weeks ago without any updates/changes in an untouched system
  • worked through all suggested fixes (2FA reauth , same IP, core restart, hard reboot, waiting a few days, ...) without success
  • Mi account doesn't give any option to disable/engage 2FA; standard control of robot does work without problems; HA system and add-ons/components all up to date Any help would be highly appreciated!

Hi, I have the same problem with the alarm, I can no longer access my account, 2fa check gives me ok but then does not log in

Niconaco avatar Jul 24 '22 19:07 Niconaco

Unfortunately have to join in on this:

  • stopped working ~1,5 weeks ago without any updates/changes in an untouched system
  • worked through all suggested fixes (2FA reauth , same IP, core restart, hard reboot, waiting a few days, ...) without success
  • Mi account doesn't give any option to disable/engage 2FA; standard control of robot does work without problems; HA system and add-ons/components all up to date Any help would be highly appreciated!

Same here, and after 5 attempts you're locked out for 24 hours. And 2 token extractors having the same, getting invalid login message. So maybe a common problem with MFA from the Xiaomi account.

QuadNL avatar Jul 25 '22 09:07 QuadNL

And 2 token extractors having the same

Are you talking about different tools? Which ones?

PiotrMachowski avatar Jul 25 '22 09:07 PiotrMachowski

In fact, 3. 1, The link which is generated in the map_extractor at reloading of the addon 2, the token_extractor.exe: https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor 3, Get.token.exe: https://github.com/Maxmudjon/com.xiaomi-miio/blob/master/docs/obtain_token.md b5fnz08gvj RlMylVLncL

QuadNL avatar Jul 25 '22 09:07 QuadNL

I'm experiencing the same problem. 2FA works on the Xiaomi app and website, but does not work for the token extractor or the cloud map extractor.

jeroenbyl avatar Jul 25 '22 19:07 jeroenbyl

@MiralDesai hi, any luck on this problem?

I run Hassos in a VM and my VM has not the same IP as my MacMini even thought they are on the same local network.

I have tryed to run the link in my browser but this is from my MacMinis local IP. How can i run this code from my Hassos VM to get the right auth IP?

Have a nice day :)

@digitalit No luck unfortunately, from time to time I will enter a 2fa code and refresh homeassistant or the component but no luck like a few others who said it randomly started working.

I think public IP is the important one and I imagine that is the same as the mac mini. Local network IP is different. All devices on my network have the same public IP so in theory I could use any device to accept the 2fa. If only it worked.

MiralDesai avatar Jul 25 '22 20:07 MiralDesai

Is anyone getting this to run ? I have the same Issue

I also tried to disable my adguard server and also tried to change the DNS on the devices to 8.8.8.8 and not my adguard.

So any other idea for a fix ?

best beni

Csejka avatar Jul 28 '22 15:07 Csejka

I managed to work around this issue by creating a completely new Mi Home account by using phone number only. It didn't ask for 2FA this way (at least for me), and if I won't enable it then it seems to work just fine. This is of course suboptimal as one cannot secure their account with 2FA this way, but at least it should work for a hack :sweat_smile:

Jonesus avatar Jul 28 '22 16:07 Jonesus

Sono riuscito a ovviare a questo problema creando un account Mi Home completamente nuovo utilizzando solo il numero di telefono. Non ha richiesto 2FA in questo modo (almeno per me), e se non lo abilito, sembra funzionare bene. Questo ovviamente non è ottimale in quanto non è possibile proteggere il proprio account con 2FA in questo modo, ma almeno dovrebbe funzionare per un hack😅

Grazie mille, ho dovuto creare l'account da pc così potevo crearlo con la mail e non per forza con un numero di telefono, mettendo anche solo la mail non chiede più la verifica a 2fa grazie!

Niconaco avatar Jul 28 '22 17:07 Niconaco

Making a new account to work around 2FA is not really a solution. There needs to be a proper fix to this (:

eXifreXi avatar Jul 29 '22 08:07 eXifreXi

@Jonesus - and what are your credentials in the configuration.yaml for username ?

Csejka avatar Jul 29 '22 10:07 Csejka

@Csejka I used the numeric User ID that is shown on top of Mi Home app (either on "profile" tab or "devices" as ############'s home, do note that you also need to re-pair your vacuum into the app, and after that also extract the vacuum token again with https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor (old vacuum token won't work)

I agree that this isn't a proper solution, but it might be worth it to someone other than me too if they don't have the knowhow of contributing a fixing PR

Jonesus avatar Jul 29 '22 11:07 Jonesus

I agree that this isn't a proper solution, but it might be worth it to someone other than me too if they don't have the knowhow of contributing a fixing PR

I'm just trying to make sure that this won't end in "There will be no fix, just use that workaround." :D

eXifreXi avatar Jul 29 '22 11:07 eXifreXi

I'm just trying to make sure that this won't end in "There will be no fix, just use that workaround." :D

Unfortunately right now I don't have any idea how to fix it (and I can't reproduce it as well) :/

PiotrMachowski avatar Jul 29 '22 11:07 PiotrMachowski

I'm just trying to make sure that this won't end in "There will be no fix, just use that workaround." :D

Unfortunately right now I don't have any idea how to fix it (and I can't reproduce it as well) :/

Hm, that's unfortunate. I haven't tried anything anymore since the initial attempt. The Map is currently just saying that the 2FA is required. The controls should work though, just the Map part of the card is not showing/working.

Are there any logs you could use? I guess it could totally be a network setup, but not sure what could be wrong. I had the issue on the token thingy too, and there I was performing the 2FA step on the very same device.

If the problem is on Xiaomi's side, then 2FA wouldn't work over two login attempts in general, so basically it would always request the 2FA over and over again. Haven't checked that yet. If the login on the website with 2FA however works, then maybe they expect something to be sent that changed?

This is a bit out of my comfort zone in terms of programming :P

eXifreXi avatar Jul 29 '22 12:07 eXifreXi

I don't have 2FA enabled though and I still get this error, so I don't know if the problem is actually from the 2FA or not. Is there any way to get some more verbose logs to see exactly what is going on, what calls it's trying to make, what it sends, what it receives?

barrelltitor avatar Jul 31 '22 03:07 barrelltitor

I have the same problem... Hopefully there will be a solution soon :(

tontonbv avatar Aug 01 '22 18:08 tontonbv

Same error here. Normally it would just go away in a few days. Or after doing the 2FA. But not this time. Hopefully someone can find a permanent fix to this recurring issue.....

dbloom86 avatar Aug 02 '22 08:08 dbloom86

In fact, 3. 1, The link which is generated in the map_extractor at reloading of the addon 2, the token_extractor.exe: https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor 3, Get.token.exe: https://github.com/Maxmudjon/com.xiaomi-miio/blob/master/docs/obtain_token.md b5fnz08gvj RlMylVLncL

If you need only extract token you can use this workaround

  1. Please download Bluestacts from here https://www.bluestacks.com/pl/index.html

  2. Please download APK file with MiHome -> it must be in version 5.4.55 image link: https://android-apk.org/com.xiaomi.smarthome/43397902-mi-home/

  3. Install it by this option image

  4. Login to this application

  5. You should see your devices image

  6. Please don't worry that when click your device you see error like this image

  7. Now please navigate to this location on virtual mobile phone image

  8. Open it and copy from there your tokens from available devices image

gacmistrz2007 avatar Aug 02 '22 09:08 gacmistrz2007

@gacmistrz2007 it is a repo of map extractor, I doubt that anybody is here just for a token ;)

PiotrMachowski avatar Aug 02 '22 09:08 PiotrMachowski

The problem seems to be with the Xiaomi Account itself, not with the map extractor.

Can the people above try adding a regular xiaomi miio device using the xiaomi miio integration? Maybe remove the vacuum and try adding it again, or something you maybe don't use much? For me it won't work to use the cloud connection for that integration either.

I made a new account that I made using only e-mail, without a phone number, and it works perfectly with this new account. I don't think there's an alternative other than contacting xiaomi support.

Would be great if others can try this too

barrelltitor avatar Aug 05 '22 04:08 barrelltitor

Creating a new account is not an option. (re)adding (new) Miio devices is not a solution either because you'll never get a token from these devices anymore.

QuadNL avatar Aug 05 '22 19:08 QuadNL

I was getting the same error for about two weeks. Now I added new sensors to my home and needed to get tokens and found out, that the token extractor was giving me the same error.

I tried to log to my xiaomi account to see if I can somewhere disable two factor authentization (here: https://account.xiaomi.com/). I opened every menu that was there, but when clicked to privacy (https://account.xiaomi.com/fe/service/account/privacy), I was asked for 2 factor authentization. When I passed this check, everything started to work. (I was on the same network as HA - so the same public IP.)

I get the new tokens for my new sensors and after reloading, the map started working again.

So this might be good workaround for this issue.

Gh61 avatar Aug 09 '22 15:08 Gh61

Create a new Mi Account did it for me! Thank you guys for all of your suggestions!

vegardofstad avatar Aug 13 '22 18:08 vegardofstad

Create a new Mi Account did it for me! Thank you guys for all of your suggestions!

But that is not really a solution. ;)

QuadNL avatar Aug 13 '22 18:08 QuadNL

On my case, it happens now and then, map extractor show the message "Two factor authentication required" and map doesn't show. It happened twice in the last month. On both cases, I had to open Mi Home application, and then a message pop up about terms and conditions had changed, I had to agree the new ToS and the map showed on the Mi App. Then restarting HA map showed back without any issue. Don't know if it was just a coincidence, but I wanted to let you all know this.

adocampo avatar Aug 13 '22 20:08 adocampo

Hi guys,

I have tryed all things i can find for months now but i still get no maps only "Two factor authentication required"

I really miss using zone cleaning but now i have to just press clean and the vacum cleant everywhere.

Is it possible that Xiaomi has found a way to lock every third party apps out like HA?

I'm so sorry but im not that slkilled to provide any high tech logs all i can tell you is that i run Hassos in a VM and i have e payed for Nabu Casa account and i get the same error on both local access and Nabu Casa remote.

Have a nice day

digitalit avatar Aug 22 '22 11:08 digitalit

Ah well, this works for me, not really a solution but hé i can manage my MiHome devices again from HA. I created a new account, after that, i shared in MiHome app the original house and devices with that account.

Change the account to your newly created cloud account in secrets.yaml, restart and you should ready to go.

QuadNL avatar Aug 22 '22 15:08 QuadNL

Hi guys I confirm that creating a new account helps. I didn’t have a lot of devices and decided to remove my current Mi account and create the new one with the same credentials. Add all of my devices again and now all works perfectly.

Xiaomi User manual says:

  1. We stopped supporting 2-step verification on December 31, 2018.
  2. If you can't sign in to your Mi Account because 2-step verification is required, call our customer support.

I wrote to the xiaomi support to remove 2FA from my account, they asked too many questions according to my applications, implementations and so on. That’s why I decided just to delete and create the new one.

oandry72 avatar Aug 23 '22 08:08 oandry72

Well,

I have everything regarding vacums from my HA and since i don't hav eny other Xiaomi devices i'd rather have an clean Roborock integration in HA until then i will controll my vacums from the official ROborock app.

Thank you.

digitalit avatar Aug 23 '22 09:08 digitalit

@digitalit If you add a new account, just share your home and devices with that account. Use that account for Home Assistant and you're off to go. So you don't need te reset your devices or generate new access tokens.

QuadNL avatar Aug 23 '22 09:08 QuadNL

@oandry72 Writing to Xiaomi is a risky thing to do, I don't know if they are aware of applications that connect to their cloud without official application. They might decide to block this "hole"

PiotrMachowski avatar Aug 23 '22 09:08 PiotrMachowski

@oandry72 Writing to Xiaomi is a risky thing to do, I don't know if they are aware of applications that connect to their cloud without official application. They might decide to block this "hole"

I haven’t answered them, because of the reason you have mentioned. And recreated my account

oandry72 avatar Aug 23 '22 09:08 oandry72

By the way, it might be possible that changing a password also fixes 2FA error, can somebody test and confirm it?

PiotrMachowski avatar Aug 23 '22 09:08 PiotrMachowski

By the way, it might be possible that changing a password also fixes 2FA error, can somebody test and confirm it?

Didn't work, even i thought that maybe some characters can cause this issue. I created a new mailaccount (alias on my domain) like [email protected], and shared my home and devices with it. I set the new account as manager in the MiHome app and the new account is also able to resolve access tokens.

QuadNL avatar Aug 23 '22 09:08 QuadNL

Lots of workarounds, but do we actually know what the issue is? Like, why is this happening to begin with? Are there any logs that we can share? I asked that before.

@PiotrMachowski you said you don't have the issue on your end, right?

Do we need to share anything with you that might help? Maybe it's just a matter of handling something differently. The other app to retrieve the token clearly works if one updates the script by hand via the website response when authenticating. Maybe there is some additional setup data one can add manually to the HA part in the same way?

eXifreXi avatar Aug 23 '22 18:08 eXifreXi

Lots of workarounds, but do we actually know what the issue is? Like, why is this happening to begin with? Are there any logs that we can share? I asked that before.

@eXifreXi This is a problem with authentication in Xiaomi cloud. It is possible that this problem is on server side - a mechanism to prevent access to cloud in an "unofficial" way. Logs from map extractor won't help.

@PiotrMachowski you said you don't have the issue on your end, right?

Yes, I had this problem once, but it disappeared after a reload and never appeared again.

Do we need to share anything with you that might help? Maybe it's just a matter of handling something differently. The other app to retrieve the token clearly works if one updates the script by hand via the website response when authenticating. Maybe there is some additional setup data one can add manually to the HA part in the same way?

It doesn't seem reasonable to integrate similar approach in HA, you would probably need to provide this data after every HA restart.

The same problem also exists in different places:

  • library that is used in HA itself: https://github.com/Squachen/micloud/issues/6
  • integrations: https://github.com/al-one/hass-xiaomi-miot/issues/649
  • OpenHab: https://community.openhab.org/t/xiaomi-mi-io-binding-error-logging-on-to-xiaomi-cloud/128534/6
  • and others

PiotrMachowski avatar Aug 23 '22 22:08 PiotrMachowski

@PiotrMachowski Thanks for clarifying!

eXifreXi avatar Aug 25 '22 08:08 eXifreXi