Fix Rest switch init was not retrying if unreachable at setup (#90627)
* Fix Rest switch init was not retrying if unreachable at setup * pass error log to platformnotready prevents spamming the same message in logs.pull/90855/head
parent
75694307e2
commit
bacd77a03a
|
@ -28,6 +28,7 @@ from homeassistant.const import (
|
||||||
CONF_VERIFY_SSL,
|
CONF_VERIFY_SSL,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
from homeassistant.helpers import config_validation as cv, template
|
from homeassistant.helpers import config_validation as cv, template
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
@ -97,8 +98,8 @@ async def async_setup_platform(
|
||||||
"Missing resource or schema in configuration. "
|
"Missing resource or schema in configuration. "
|
||||||
"Add http:// or https:// to your URL"
|
"Add http:// or https:// to your URL"
|
||||||
)
|
)
|
||||||
except (asyncio.TimeoutError, aiohttp.ClientError):
|
except (asyncio.TimeoutError, aiohttp.ClientError) as exc:
|
||||||
_LOGGER.error("No route to resource/endpoint: %s", resource)
|
raise PlatformNotReady(f"No route to resource/endpoint: {resource}") from exc
|
||||||
|
|
||||||
|
|
||||||
class RestSwitch(TemplateEntity, SwitchEntity):
|
class RestSwitch(TemplateEntity, SwitchEntity):
|
||||||
|
|
Loading…
Reference in New Issue