## Introduction to Xiaomi Home Assistant
The Xiaomi Home Assistant is a popular home automation system that integrates various devices to provide a seamlesssmart home experience. However, users may encounter issues with the system, such as failed token refresh, unauthorized access, and connection errors.
## Understanding the Issue
In this case, the user is experiencing an issue where the automatic token refresh fails, resulting in a failed control of devices and an "account expired" notification from the Xiaomi Home Assistant.
## Steps to Reproduce the Issue
1. Attempt to control a device using the Xiaomi Home Assistant.
2. Observe the Home Assistant logs for any error messages related to token refresh or unauthorized access.
3. Check the system version and integration version to ensure they are up-to-date.
## Expected Behavior
The system should be able to automatically refresh the token and maintain device control without any issues.
## Home Assistant Logs
The logs show various error messages related to token refresh, unauthorized access, and connection errors. The errors are as follows:
* `refresh props failed, cloud, ['**********|2|5']`
* `refresh oauth info error (**********, cn), 'MIoTOauthClient' object has no attribute '_get_token_async'`
* `mihome api get failed, unauthorized(401)`
* `Unclosed client session (None)`
* `Unclosed connector (None)`
## Troubleshooting Steps
1. Check the system version and integration version to ensure they are up-to-date.
2. Verify that the account information is correct and not expired.
3. Restart the Home Assistant and check if the issue persists.
4. Check the network connection and ensure that it is stable.
5. Try manually refreshing the token using the Xiaomi Home Assistant interface.
## Conclusion
In conclusion, the Xiaomi Home Assistant integration issue is caused by a failed token refresh, resulting in unauthorized access and connection errors. By following the troubleshooting steps and ensuring that the system and integration versions are up-to-date, users can resolve the issue and maintain a seamless smart home experience.