mirror of
https://github.com/home-assistant/core.git
synced 2025-08-01 17:48:26 +00:00
tweaks
This commit is contained in:
parent
c64e647d8f
commit
66c6aa718e
@ -452,23 +452,38 @@ class EsphomeFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
CONF_NOISE_PSK: self._noise_psk or "",
|
CONF_NOISE_PSK: self._noise_psk or "",
|
||||||
CONF_DEVICE_NAME: self._device_name,
|
CONF_DEVICE_NAME: self._device_name,
|
||||||
}
|
}
|
||||||
config_options = {
|
|
||||||
CONF_ALLOW_SERVICE_CALLS: DEFAULT_NEW_CONFIG_ALLOW_ALLOW_SERVICE_CALLS,
|
|
||||||
}
|
|
||||||
if self.source == SOURCE_RECONFIGURE:
|
if self.source == SOURCE_RECONFIGURE:
|
||||||
assert self.unique_id is not None
|
assert self.unique_id is not None
|
||||||
assert self._reconfig_entry.unique_id is not None
|
assert self._reconfig_entry.unique_id is not None
|
||||||
assert self._host is not None
|
assert self._host is not None
|
||||||
assert self._device_name is not None
|
assert self._device_name is not None
|
||||||
|
placeholders = {
|
||||||
|
"name": self._reconfig_entry.data.get(
|
||||||
|
CONF_DEVICE_NAME, self._reconfig_entry.title
|
||||||
|
),
|
||||||
|
"host": self._host,
|
||||||
|
"expected_mac": format_mac(self._reconfig_entry.unique_id),
|
||||||
|
}
|
||||||
|
for entry in self._async_current_entries(include_ignore=False):
|
||||||
|
if (
|
||||||
|
entry.entry_id != self._reconfig_entry.entry_id
|
||||||
|
and entry.data.get(CONF_DEVICE_NAME) == self._device_name
|
||||||
|
):
|
||||||
|
return self.async_abort(
|
||||||
|
reason="reconfigure_name_conflict",
|
||||||
|
description_placeholders={
|
||||||
|
**placeholders,
|
||||||
|
"existing_title": entry.title,
|
||||||
|
},
|
||||||
|
)
|
||||||
if self._reconfig_entry.unique_id != format_mac(self.unique_id):
|
if self._reconfig_entry.unique_id != format_mac(self.unique_id):
|
||||||
return self.async_abort(
|
return self.async_abort(
|
||||||
reason="reconfigure_unique_id_changed",
|
reason="reconfigure_unique_id_changed",
|
||||||
description_placeholders={
|
description_placeholders={
|
||||||
"name": self._reconfig_entry.title,
|
**placeholders,
|
||||||
"host": self._host,
|
|
||||||
"expected_mac": format_mac(self._reconfig_entry.unique_id),
|
|
||||||
"unexpected_device_name": self._device_name,
|
|
||||||
"unexpected_mac": format_mac(self.unique_id),
|
"unexpected_mac": format_mac(self.unique_id),
|
||||||
|
"unexpected_device_name": self._device_name,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return self.async_update_reload_and_abort(
|
return self.async_update_reload_and_abort(
|
||||||
@ -483,7 +498,9 @@ class EsphomeFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title=self._name,
|
title=self._name,
|
||||||
data=config_data,
|
data=config_data,
|
||||||
options=config_options,
|
options={
|
||||||
|
CONF_ALLOW_SERVICE_CALLS: DEFAULT_NEW_CONFIG_ALLOW_ALLOW_SERVICE_CALLS,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_encryption_key(
|
async def async_step_encryption_key(
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
"mqtt_missing_payload": "Missing MQTT Payload.",
|
"mqtt_missing_payload": "Missing MQTT Payload.",
|
||||||
"name_conflict_migrated": "The configuration for `{name}` has been migrated to a new device with MAC address `{mac}` from `{existing_mac}`.",
|
"name_conflict_migrated": "The configuration for `{name}` has been migrated to a new device with MAC address `{mac}` from `{existing_mac}`.",
|
||||||
"reconfigure_successful": "[%key:common::config_flow::abort::reconfigure_successful%]",
|
"reconfigure_successful": "[%key:common::config_flow::abort::reconfigure_successful%]",
|
||||||
|
"reconfigure_name_conflict": "**Reconfiguration of `{name}` was aborted** because the address `{host}` points to a device named `{name}` (MAC: `{expected_mac}`), which is already in use by another configuration entry: `{existing_title}`.",
|
||||||
"reconfigure_unique_id_changed": "**Reconfiguration of `{name}` was aborted** because the address `{host}` points to a different device: `{unexpected_device_name}` (MAC: `{unexpected_mac}`) instead of the expected one (MAC: `{expected_mac}`)."
|
"reconfigure_unique_id_changed": "**Reconfiguration of `{name}` was aborted** because the address `{host}` points to a different device: `{unexpected_device_name}` (MAC: `{unexpected_mac}`) instead of the expected one (MAC: `{expected_mac}`)."
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user