Handle device IP change in upnp (#46859)
parent
19f5b467b7
commit
3e26e2adad
|
@ -123,7 +123,10 @@ async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry)
|
|||
)
|
||||
|
||||
# Ensure entry has a hostname, for older entries.
|
||||
if CONFIG_ENTRY_HOSTNAME not in config_entry.data:
|
||||
if (
|
||||
CONFIG_ENTRY_HOSTNAME not in config_entry.data
|
||||
or config_entry.data[CONFIG_ENTRY_HOSTNAME] != device.hostname
|
||||
):
|
||||
hass.config_entries.async_update_entry(
|
||||
entry=config_entry,
|
||||
data={CONFIG_ENTRY_HOSTNAME: device.hostname, **config_entry.data},
|
||||
|
|
|
@ -179,7 +179,9 @@ class UpnpFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
discovery = await Device.async_supplement_discovery(self.hass, discovery)
|
||||
unique_id = discovery[DISCOVERY_UNIQUE_ID]
|
||||
await self.async_set_unique_id(unique_id)
|
||||
self._abort_if_unique_id_configured()
|
||||
self._abort_if_unique_id_configured(
|
||||
updates={CONFIG_ENTRY_HOSTNAME: discovery[DISCOVERY_HOSTNAME]}
|
||||
)
|
||||
|
||||
# Handle devices changing their UDN, only allow a single
|
||||
existing_entries = self.hass.config_entries.async_entries(DOMAIN)
|
||||
|
|
Loading…
Reference in New Issue