diff --git a/custom_components/localtuya/__init__.py b/custom_components/localtuya/__init__.py index d37365110..91285aac6 100644 --- a/custom_components/localtuya/__init__.py +++ b/custom_components/localtuya/__init__.py @@ -306,7 +306,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): client_id = entry.data[CONF_CLIENT_ID] secret = entry.data[CONF_CLIENT_SECRET] user_id = entry.data[CONF_USER_ID] - tuya_api = TuyaCloudApi(hass, region, client_id, secret, user_id) + tuya_api = TuyaCloudApi(region, client_id, secret, user_id) no_cloud = entry.data.get(CONF_NO_CLOUD, True) if no_cloud: diff --git a/custom_components/localtuya/config_flow.py b/custom_components/localtuya/config_flow.py index 7a8c9b23e..d59fa62d1 100644 --- a/custom_components/localtuya/config_flow.py +++ b/custom_components/localtuya/config_flow.py @@ -191,7 +191,7 @@ async def async_step_user(self, user_input=None): user_input[i] = "" return await self._create_entry(user_input) - cloud_api, res = await attempt_cloud_connection(self.hass, user_input) + cloud_api, res = await attempt_cloud_connection(user_input) if not res: return await self._create_entry(user_input) @@ -284,7 +284,7 @@ async def async_step_configure_cloud(self, user_input=None): return self._update_entry(new_data, new_title=username) - cloud_api, res = await attempt_cloud_connection(self.hass, user_input) + cloud_api, res = await attempt_cloud_connection(user_input) if not res: new_data = self.config_entry.data.copy() @@ -1330,10 +1330,9 @@ async def validate_input(hass: HomeAssistant, entry_id, data): } -async def attempt_cloud_connection(hass, user_input): +async def attempt_cloud_connection(user_input): """Create device.""" cloud_api = TuyaCloudApi( - hass, user_input.get(CONF_REGION), user_input.get(CONF_CLIENT_ID), user_input.get(CONF_CLIENT_SECRET),