mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Prevent Synology Camera doing I/O in event loop (#34442)
This commit is contained in:
parent
26f78132ae
commit
bd46a6130a
@ -1,4 +1,5 @@
|
|||||||
"""Support for Synology Surveillance Station Cameras."""
|
"""Support for Synology Surveillance Station Cameras."""
|
||||||
|
from functools import partial
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
@ -45,12 +46,15 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||||||
timeout = config.get(CONF_TIMEOUT)
|
timeout = config.get(CONF_TIMEOUT)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
surveillance = SurveillanceStation(
|
surveillance = await hass.async_add_executor_job(
|
||||||
config.get(CONF_URL),
|
partial(
|
||||||
config.get(CONF_USERNAME),
|
SurveillanceStation,
|
||||||
config.get(CONF_PASSWORD),
|
config.get(CONF_URL),
|
||||||
verify_ssl=verify_ssl,
|
config.get(CONF_USERNAME),
|
||||||
timeout=timeout,
|
config.get(CONF_PASSWORD),
|
||||||
|
verify_ssl=verify_ssl,
|
||||||
|
timeout=timeout,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
except (requests.exceptions.RequestException, ValueError):
|
except (requests.exceptions.RequestException, ValueError):
|
||||||
_LOGGER.exception("Error when initializing SurveillanceStation")
|
_LOGGER.exception("Error when initializing SurveillanceStation")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user