mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Ensure isy994 is only discovered once (#50577)
The formatting of the mac was different between dhcp and ssdp
This commit is contained in:
parent
c079803fcb
commit
52edf9ac35
@ -155,7 +155,10 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
friendly_name = discovery_info[HOSTNAME]
|
friendly_name = discovery_info[HOSTNAME]
|
||||||
url = f"http://{discovery_info[IP_ADDRESS]}"
|
url = f"http://{discovery_info[IP_ADDRESS]}"
|
||||||
mac = discovery_info[MAC_ADDRESS]
|
mac = discovery_info[MAC_ADDRESS]
|
||||||
await self.async_set_unique_id(mac)
|
isy_mac = (
|
||||||
|
f"{mac[0:2]}:{mac[2:4]}:{mac[4:6]}:{mac[6:8]}:{mac[8:10]}:{mac[10:12]}"
|
||||||
|
)
|
||||||
|
await self.async_set_unique_id(isy_mac)
|
||||||
self._abort_if_unique_id_configured()
|
self._abort_if_unique_id_configured()
|
||||||
|
|
||||||
self.discovered_conf = {
|
self.discovered_conf = {
|
||||||
|
@ -61,7 +61,8 @@ MOCK_IMPORT_FULL_CONFIG = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MOCK_DEVICE_NAME = "Name of the device"
|
MOCK_DEVICE_NAME = "Name of the device"
|
||||||
MOCK_UUID = "CE:FB:72:31:B7:B9"
|
MOCK_UUID = "ce:fb:72:31:b7:b9"
|
||||||
|
MOCK_MAC = "cefb7231b7b9"
|
||||||
MOCK_VALIDATED_RESPONSE = {"name": MOCK_DEVICE_NAME, "uuid": MOCK_UUID}
|
MOCK_VALIDATED_RESPONSE = {"name": MOCK_DEVICE_NAME, "uuid": MOCK_UUID}
|
||||||
|
|
||||||
PATCH_CONFIGURATION = "homeassistant.components.isy994.config_flow.Configuration"
|
PATCH_CONFIGURATION = "homeassistant.components.isy994.config_flow.Configuration"
|
||||||
@ -331,7 +332,7 @@ async def test_form_dhcp(hass: HomeAssistant):
|
|||||||
data={
|
data={
|
||||||
dhcp.IP_ADDRESS: "1.2.3.4",
|
dhcp.IP_ADDRESS: "1.2.3.4",
|
||||||
dhcp.HOSTNAME: "isy994-ems",
|
dhcp.HOSTNAME: "isy994-ems",
|
||||||
dhcp.MAC_ADDRESS: MOCK_UUID,
|
dhcp.MAC_ADDRESS: MOCK_MAC,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||||
|
Loading…
x
Reference in New Issue
Block a user