diff --git a/custom_components/midea_ac_lan/__init__.py b/custom_components/midea_ac_lan/__init__.py index 4ee8c147..0220e985 100644 --- a/custom_components/midea_ac_lan/__init__.py +++ b/custom_components/midea_ac_lan/__init__.py @@ -145,19 +145,22 @@ async def async_setup_entry(hass: HomeAssistant, config_entry): if protocol == 3 and (key is None or key is None): _LOGGER.error("For V3 devices, the key and the token is required.") return False - device = device_selector( - name=name, - device_id=device_id, - device_type=device_type, - ip_address=ip_address, - port=port, - token=token, - key=key, - protocol=protocol, - model=model, - subtype=subtype, - customize=customize, - ) + + def _device_selector(): + return device_selector( + name=name, + device_id=device_id, + device_type=device_type, + ip_address=ip_address, + port=port, + token=token, + key=key, + protocol=protocol, + model=model, + subtype=subtype, + customize=customize, + ) + device = await hass.async_add_import_executor_job(_device_selector) if refresh_interval is not None: device.set_refresh_interval(refresh_interval) if device: