Xiaomi Miio appropriatly raise ConfigEntryAuthFailed/ConfigEntryNotReady (#54696)

* Add reties to cloud login

* push to version 0.4 of micloud

* distinguish between authentication error and socket errors

* raise from error

* Update homeassistant/components/xiaomi_miio/gateway.py

Co-authored-by: Franck Nijhof <git@frenck.dev>

* move ConfigEntryNotReady to connect function

* remove unused import

* also add ConfigEntryNotReady for device

* catch exceptions in config flow

* fixes

* bring tests back to 100%

* add missing catch exception

* add test

* fix black

* Update homeassistant/components/xiaomi_miio/device.py

Co-authored-by: Teemu R. <tpr@iki.fi>

* Update homeassistant/components/xiaomi_miio/gateway.py

Co-authored-by: Teemu R. <tpr@iki.fi>

* Update tests/components/xiaomi_miio/test_config_flow.py

Co-authored-by: Teemu R. <tpr@iki.fi>

* fix tests

* define specific exceptions

* fix styling

* fix tests

* use proper DeviceException

* Revert "use proper DeviceException"

This reverts commit 0bd16135387cd6d9e563cd62ac147d0a25c577f3.

* use appropriate side-effect

* remove unused returns

* Update homeassistant/components/xiaomi_miio/const.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* remove unused returns

Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Teemu R. <tpr@iki.fi>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
starkillerOG 2021-10-15 01:25:44 +02:00 committed by GitHub
parent c243dca58e
commit e34aed743c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 129 additions and 49 deletions

View file

@ -37,6 +37,16 @@ SUCCESS = ["ok"]
SERVER_COUNTRY_CODES = ["cn", "de", "i2", "ru", "sg", "us"]
DEFAULT_CLOUD_COUNTRY = "cn"
# Exceptions
class AuthException(Exception):
"""Exception indicating an authentication error."""
class SetupException(Exception):
"""Exception indicating a failure during setup."""
# Fan Models
MODEL_AIRPURIFIER_2H = "zhimi.airpurifier.mc2"
MODEL_AIRPURIFIER_2S = "zhimi.airpurifier.mc1"