Handle missing MAC address during daikin discovery (#38840)
* Abort flow if MAC-address can't be found * Apply suggestions from code review Co-authored-by: Chris Talkington <chris@talkingtontech.com> Co-authored-by: Chris Talkington <chris@talkingtontech.com>
This commit is contained in:
parent
70c028458f
commit
68047f7c1a
2 changed files with 9 additions and 1 deletions
|
@ -130,6 +130,13 @@ class FlowHandler(config_entries.ConfigFlow):
|
|||
"""Prepare configuration for a discovered Daikin device."""
|
||||
_LOGGER.debug("Zeroconf user_input: %s", discovery_info)
|
||||
devices = Discovery().poll(ip=discovery_info[CONF_HOST])
|
||||
if not devices:
|
||||
_LOGGER.debug(
|
||||
"Could not find MAC-address for %s,"
|
||||
" make sure the required UDP ports are open (see integration documentation).",
|
||||
discovery_info[CONF_HOST],
|
||||
)
|
||||
return self.async_abort(reason="cannot_connect")
|
||||
await self.async_set_unique_id(next(iter(devices))[KEY_MAC])
|
||||
self._abort_if_unique_id_configured()
|
||||
self.host = discovery_info[CONF_HOST]
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
}
|
||||
},
|
||||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
||||
},
|
||||
"error": {
|
||||
"device_fail": "[%key:common::config_flow::error::unknown%]",
|
||||
|
|
Loading…
Add table
Reference in a new issue