Add and improve Homekit controller pairing messages and errors (#23532)

* Be clear about pairing code format

* Handle more homekit errors while pairing

* Update en translation

* Fix log message feedback
This commit is contained in:
Jc2k authored and Aaron Bach committed 2019-05-01 17:02:29 -06:00
1 parent 44d0d0624b
commit 7ff77936ad
4 files changed
+115 -4

No files matched your search

@@ -237,8 +237,21 @@ class HomekitControllerFlowHandler(config_entries.ConfigFlow):
errors['pairing_code'] = 'authentication_error'
except homekit.UnknownError:
errors['pairing_code'] = 'unknown_error'
except homekit.MaxTriesError:
errors['pairing_code'] = 'max_tries_error'
except homekit.BusyError:
errors['pairing_code'] = 'busy_error'
except homekit.MaxPeersError:
errors['pairing_code'] = 'max_peers_error'
except homekit.AccessoryNotFoundError:
return self.async_abort(reason='accessory_not_found_error')
except homekit.UnavailableError:
return self.async_abort(reason='already_paired')
except Exception: # pylint: disable=broad-except
_LOGGER.exception(
"Pairing attempt failed with an unhandled exception"
)
errors['pairing_code'] = 'pairing_failed'
return self.async_show_form(
step_id='pair',