home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.48k stars 30.7k forks source link

Xiaomi Integration login failures no more solution to add devices to Home Assistant #128493

Open HomeAssistantPim opened 3 weeks ago

HomeAssistantPim commented 3 weeks ago

The problem

The problem seems to be that Xiaomi has changed their login api. All tools seem to fail now (Integration can't get past login to cloud, token extractos dito).

The only thing which might work judging from the documentation: "Use of Miio should be done before the Vacuum is connected to Mi Home. If you already connected to the app you will need to delete it and then join the ad-hoc Wi-Fi network the Vacuum creates. If the vacuum is already paired it’s likely this method will only return ??? as your token."

then with npx miio discover you should get a token.

Two questions: 1) this miio tool would be this one? pip3 install python-miio 2) If your first pair your laptop with the ad-hoc network and discover the device to get a token. Is this token still usable once you've added to vacuum robot to your wifi (using the Mi Home app)??

What version of Home Assistant Core has the issue?

2024.4.3

What was the last working version of Home Assistant Core?

2024.4.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

xiaomi_miio

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 3 weeks ago

Hey there @rytilahti, @syssi, @starkillerog, mind taking a look at this issue as it has been labeled with an integration (xiaomi_miio) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `xiaomi_miio` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign xiaomi_miio` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


xiaomi_miio documentation xiaomi_miio source (message by IssueLinks)

HomeAssistantPim commented 3 weeks ago

After some investigation on my own I suspect that Xiaomi is moving towards OAuth2 managed security tokens. For sure is that the token is being refreshed when the device connects with a different WiFi network and afterwards no longer responds to UDP packets (lacking a valid token?). My guess: Xiaomi is moved towards a scenario were to use such Xiaomi devices within HA you would require to buy some Xiaomi hub/gateway or some cloud service that can be integrated to colaborate with other smart home systems :(