Retry solaredge on socket.gaierror (#95153)

This commit is contained in:
J. Nick Koston 2023-06-24 15:10:54 -05:00 committed by GitHub
parent 5059cee53f
commit 3ea26efac9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,8 @@
"""The SolarEdge integration."""
from __future__ import annotations
import socket
from requests.exceptions import ConnectTimeout, HTTPError
from solaredge import Solaredge
@ -25,7 +27,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
response = await hass.async_add_executor_job(
api.get_details, entry.data[CONF_SITE_ID]
)
except (ConnectTimeout, HTTPError) as ex:
except (ConnectTimeout, HTTPError, socket.gaierror) as ex:
LOGGER.error("Could not retrieve details from SolarEdge API")
raise ConfigEntryNotReady from ex