Skip to content

Commit

Permalink
Fix add integration for new users
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Oct 11, 2020
1 parent c7577ec commit 3abb2a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions custom_components/xiaomi_gateway3/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def async_step_user(self, user_input=None):
description_placeholders={'error_text': ''}
)

if 'devices' in self.hass.data[DOMAIN]:
if DOMAIN in self.hass.data and 'devices' in self.hass.data[DOMAIN]:
for device in self.hass.data[DOMAIN]['devices']:
if (device['model'] == 'lumi.gateway.mgl03' and
device['did'] not in ACTIONS):
Expand All @@ -65,7 +65,7 @@ async def async_step_user(self, user_input=None):
async def async_step_cloud(self, user_input=None, error=None):
if user_input:
if not user_input['servers']:
return self.async_step_cloud(error='no_servers')
return await self.async_step_cloud(error='no_servers')

session = async_create_clientsession(self.hass)
cloud = MiCloud(session)
Expand All @@ -76,7 +76,7 @@ async def async_step_cloud(self, user_input=None, error=None):
data=user_input)

else:
return self.async_step_cloud(error='cant_login')
return await self.async_step_cloud(error='cant_login')

return self.async_show_form(
step_id='cloud',
Expand Down
2 changes: 1 addition & 1 deletion custom_components/xiaomi_gateway3/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"config": {
"error": {
"no_servers": "Please select at least one server",
"cant_login": "Can't login. Check logs for more info"
"cant_login": "Can't login, check username and password"
},
"step": {
"user": {
Expand Down

0 comments on commit 3abb2a1

Please sign in to comment.