mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
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
@ -130,6 +130,13 @@ class FlowHandler(config_entries.ConfigFlow):
|
|||||||
"""Prepare configuration for a discovered Daikin device."""
|
"""Prepare configuration for a discovered Daikin device."""
|
||||||
_LOGGER.debug("Zeroconf user_input: %s", discovery_info)
|
_LOGGER.debug("Zeroconf user_input: %s", discovery_info)
|
||||||
devices = Discovery().poll(ip=discovery_info[CONF_HOST])
|
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])
|
await self.async_set_unique_id(next(iter(devices))[KEY_MAC])
|
||||||
self._abort_if_unique_id_configured()
|
self._abort_if_unique_id_configured()
|
||||||
self.host = discovery_info[CONF_HOST]
|
self.host = discovery_info[CONF_HOST]
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"abort": {
|
"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": {
|
"error": {
|
||||||
"device_fail": "[%key:common::config_flow::error::unknown%]",
|
"device_fail": "[%key:common::config_flow::error::unknown%]",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user