Fix blocking call in Bang & Olufsen API client initialization (#126456)
* Update API * Add fix for blocking call to load_default_certspull/126566/head
parent
c9571126a3
commit
08b0064ce7
|
@ -17,6 +17,7 @@ from homeassistant.const import CONF_HOST, CONF_MODEL, Platform
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
import homeassistant.helpers.device_registry as dr
|
||||
from homeassistant.util.ssl import get_default_context
|
||||
|
||||
from .const import DOMAIN
|
||||
from .websocket import BangOlufsenWebsocket
|
||||
|
@ -48,7 +49,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
model=entry.data[CONF_MODEL],
|
||||
)
|
||||
|
||||
client = MozartClient(host=entry.data[CONF_HOST])
|
||||
client = MozartClient(host=entry.data[CONF_HOST], ssl_context=get_default_context())
|
||||
|
||||
# Check API and WebSocket connection
|
||||
try:
|
||||
|
|
|
@ -14,6 +14,7 @@ from homeassistant.components.zeroconf import ZeroconfServiceInfo
|
|||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||
from homeassistant.const import CONF_HOST, CONF_MODEL
|
||||
from homeassistant.helpers.selector import SelectSelector, SelectSelectorConfig
|
||||
from homeassistant.util.ssl import get_default_context
|
||||
|
||||
from .const import (
|
||||
ATTR_FRIENDLY_NAME,
|
||||
|
@ -87,7 +88,9 @@ class BangOlufsenConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
errors={"base": _exception_map[type(error)]},
|
||||
)
|
||||
|
||||
self._client = MozartClient(self._host)
|
||||
self._client = MozartClient(
|
||||
host=self._host, ssl_context=get_default_context()
|
||||
)
|
||||
|
||||
# Try to get information from Beolink self method.
|
||||
async with self._client:
|
||||
|
@ -136,7 +139,7 @@ class BangOlufsenConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
return self.async_abort(reason="ipv6_address")
|
||||
|
||||
# Check connection to ensure valid address is received
|
||||
self._client = MozartClient(self._host)
|
||||
self._client = MozartClient(self._host, ssl_context=get_default_context())
|
||||
|
||||
async with self._client:
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue