Skip to content

Commit

Permalink
Update LT to and remove hass object from cloud_api
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed Jan 11, 2025
1 parent 7e6253c commit 3ecfd89
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion custom_components/localtuya/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 3 additions & 4 deletions custom_components/localtuya/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 3ecfd89

Please sign in to comment.