Use async_connect in newly bumped 0.5.8 UPB library (#121789)
parent
86db976ed7
commit
c84fe04d6b
|
@ -26,7 +26,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
|||
file = config_entry.data[CONF_FILE_PATH]
|
||||
|
||||
upb = upb_lib.UpbPim({"url": url, "UPStartExportFile": file})
|
||||
upb.connect()
|
||||
await upb.async_connect()
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
hass.data[DOMAIN][config_entry.entry_id] = {"upb": upb}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ async def _validate_input(data):
|
|||
|
||||
upb = upb_lib.UpbPim({"url": url, "UPStartExportFile": file_path})
|
||||
|
||||
upb.connect(_connected_callback)
|
||||
await upb.async_connect(_connected_callback)
|
||||
|
||||
if not upb.config_ok:
|
||||
_LOGGER.error("Missing or invalid UPB file: %s", file_path)
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
"documentation": "https://www.home-assistant.io/integrations/upb",
|
||||
"iot_class": "local_push",
|
||||
"loggers": ["upb_lib"],
|
||||
"requirements": ["upb-lib==0.5.7"]
|
||||
"requirements": ["upb-lib==0.5.8"]
|
||||
}
|
||||
|
|
|
@ -2818,7 +2818,7 @@ unifiled==0.11
|
|||
universal-silabs-flasher==0.0.21
|
||||
|
||||
# homeassistant.components.upb
|
||||
upb-lib==0.5.7
|
||||
upb-lib==0.5.8
|
||||
|
||||
# homeassistant.components.upcloud
|
||||
upcloud-api==2.5.1
|
||||
|
|
|
@ -2192,7 +2192,7 @@ unifi-discovery==1.2.0
|
|||
universal-silabs-flasher==0.0.21
|
||||
|
||||
# homeassistant.components.upb
|
||||
upb-lib==0.5.7
|
||||
upb-lib==0.5.8
|
||||
|
||||
# homeassistant.components.upcloud
|
||||
upcloud-api==2.5.1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Test the UPB Control config flow."""
|
||||
|
||||
from asyncio import TimeoutError
|
||||
from unittest.mock import MagicMock, PropertyMock, patch
|
||||
from unittest.mock import AsyncMock, PropertyMock, patch
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.upb.const import DOMAIN
|
||||
|
@ -15,11 +15,11 @@ def mocked_upb(sync_complete=True, config_ok=True):
|
|||
def _upb_lib_connect(callback):
|
||||
callback()
|
||||
|
||||
upb_mock = MagicMock()
|
||||
upb_mock = AsyncMock()
|
||||
type(upb_mock).network_id = PropertyMock(return_value="42")
|
||||
type(upb_mock).config_ok = PropertyMock(return_value=config_ok)
|
||||
if sync_complete:
|
||||
upb_mock.connect.side_effect = _upb_lib_connect
|
||||
upb_mock.async_connect.side_effect = _upb_lib_connect
|
||||
return patch(
|
||||
"homeassistant.components.upb.config_flow.upb_lib.UpbPim", return_value=upb_mock
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue