mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
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.
This commit is contained in:
parent
f1fa63281e
commit
9cab05c4b9
@ -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…
x
Reference in New Issue
Block a user