Fix ps4 no creds with additional device (#22300)
* Fix no creds with additional device. * Update config_flow.pypull/21823/head^2
parent
7421156dfc
commit
88df2e0ea5
|
@ -79,7 +79,11 @@ class PlayStation4FlowHandler(config_entries.ConfigFlow):
|
|||
|
||||
# If entry exists check that devices found aren't configured.
|
||||
if self.hass.config_entries.async_entries(DOMAIN):
|
||||
creds = {}
|
||||
for entry in self.hass.config_entries.async_entries(DOMAIN):
|
||||
# Retrieve creds from entry
|
||||
creds['data'] = entry.data[CONF_TOKEN]
|
||||
# Retrieve device data from entry
|
||||
conf_devices = entry.data['devices']
|
||||
for c_device in conf_devices:
|
||||
if c_device['host'] in device_list:
|
||||
|
@ -88,6 +92,11 @@ class PlayStation4FlowHandler(config_entries.ConfigFlow):
|
|||
# If list is empty then all devices are configured.
|
||||
if not device_list:
|
||||
return self.async_abort(reason='devices_configured')
|
||||
# Add existing creds for linking. Should be only 1.
|
||||
if not creds:
|
||||
# Abort if creds is missing.
|
||||
return self.async_abort(reason='credential_error')
|
||||
self.creds = creds['data']
|
||||
|
||||
# Login to PS4 with user data.
|
||||
if user_input is not None:
|
||||
|
|
Loading…
Reference in New Issue