From 425ca3fdca526a677c734f5863e0ae1b4d5be9bb Mon Sep 17 00:00:00 2001 From: mj23000 Date: Fri, 20 Sep 2024 15:28:27 +0200 Subject: [PATCH 1/2] Update API --- homeassistant/components/bang_olufsen/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/bang_olufsen/manifest.json b/homeassistant/components/bang_olufsen/manifest.json index 3cc9fdb5cd11d5..a93a6e7a6244c6 100644 --- a/homeassistant/components/bang_olufsen/manifest.json +++ b/homeassistant/components/bang_olufsen/manifest.json @@ -6,6 +6,6 @@ "documentation": "https://www.home-assistant.io/integrations/bang_olufsen", "integration_type": "device", "iot_class": "local_push", - "requirements": ["mozart-api==3.4.1.8.6"], + "requirements": ["mozart-api==3.4.1.8.8"], "zeroconf": ["_bangolufsen._tcp.local."] } diff --git a/requirements_all.txt b/requirements_all.txt index a40b660b548c9a..093227513a8609 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1390,7 +1390,7 @@ motionblindsble==0.1.1 motioneye-client==0.3.14 # homeassistant.components.bang_olufsen -mozart-api==3.4.1.8.6 +mozart-api==3.4.1.8.8 # homeassistant.components.mullvad mullvad-api==1.0.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 3fc8d2bd20eaa4..a8a0a9f66411a6 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1159,7 +1159,7 @@ motionblindsble==0.1.1 motioneye-client==0.3.14 # homeassistant.components.bang_olufsen -mozart-api==3.4.1.8.6 +mozart-api==3.4.1.8.8 # homeassistant.components.mullvad mullvad-api==1.0.0 From 5e4dd466aaf62df00a6fcd0335d57b449ddc5cba Mon Sep 17 00:00:00 2001 From: mj23000 Date: Fri, 20 Sep 2024 15:42:44 +0200 Subject: [PATCH 2/2] Add fix for blocking call to load_default_certs --- homeassistant/components/bang_olufsen/__init__.py | 3 ++- homeassistant/components/bang_olufsen/config_flow.py | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/bang_olufsen/__init__.py b/homeassistant/components/bang_olufsen/__init__.py index 07b9d0befe1c63..e11df6ad5ed4da 100644 --- a/homeassistant/components/bang_olufsen/__init__.py +++ b/homeassistant/components/bang_olufsen/__init__.py @@ -17,6 +17,7 @@ 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: diff --git a/homeassistant/components/bang_olufsen/config_flow.py b/homeassistant/components/bang_olufsen/config_flow.py index 85b7a22cd56331..e1c1c7ab538635 100644 --- a/homeassistant/components/bang_olufsen/config_flow.py +++ b/homeassistant/components/bang_olufsen/config_flow.py @@ -14,6 +14,7 @@ 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, @@ -88,7 +89,9 @@ async def async_step_user( 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: @@ -137,7 +140,7 @@ async def async_step_zeroconf( 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: