mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Improve error handling for HTTP errors on Growatt Server (#110633)
* Update dependency growattServer for improved error details Updating to latest version. Since version 1.3.1 it will raise requests.exceptions.HTTPError for unexpected API responses such as HTTP 405 (rate limiting/firewall) * Improve error details by raising ConfigEntryAuthFailed Previous code was returning None which the caller couldn't handle * Use a more appropiate exception type * Update homeassistant/components/growatt_server/sensor.py * Update homeassistant/components/growatt_server/sensor.py * Fix --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
parent
9819cdfec2
commit
ee4f55a5a9
@ -6,5 +6,5 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/growatt_server",
|
||||
"iot_class": "cloud_polling",
|
||||
"loggers": ["growattServer"],
|
||||
"requirements": ["growattServer==1.3.0"]
|
||||
"requirements": ["growattServer==1.5.0"]
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_NAME, CONF_PASSWORD, CONF_URL, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryError
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.util import Throttle, dt as dt_util
|
||||
@ -46,8 +47,7 @@ def get_device_list(api, config):
|
||||
not login_response["success"]
|
||||
and login_response["msg"] == LOGIN_INVALID_AUTH_CODE
|
||||
):
|
||||
_LOGGER.error("Username, Password or URL may be incorrect!")
|
||||
return
|
||||
raise ConfigEntryError("Username, Password or URL may be incorrect!")
|
||||
user_id = login_response["user"]["id"]
|
||||
if plant_id == DEFAULT_PLANT_ID:
|
||||
plant_info = api.plant_list(user_id)
|
||||
|
@ -1004,7 +1004,7 @@ greenwavereality==0.5.1
|
||||
gridnet==5.0.0
|
||||
|
||||
# homeassistant.components.growatt_server
|
||||
growattServer==1.3.0
|
||||
growattServer==1.5.0
|
||||
|
||||
# homeassistant.components.google_sheets
|
||||
gspread==5.5.0
|
||||
|
@ -821,7 +821,7 @@ greeneye_monitor==3.0.3
|
||||
gridnet==5.0.0
|
||||
|
||||
# homeassistant.components.growatt_server
|
||||
growattServer==1.3.0
|
||||
growattServer==1.5.0
|
||||
|
||||
# homeassistant.components.google_sheets
|
||||
gspread==5.5.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user