Skip to content

Commit

Permalink
coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Aug 23, 2023
1 parent 2a1d6c6 commit 3dfaa6a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions homeassistant/components/yeelight/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,16 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
raise ConfigEntryNotReady from ex

found_unique_id = device.unique_id
if found_unique_id and found_unique_id != entry.unique_id:
expected_unique_id = entry.unique_id
if expected_unique_id and found_unique_id and found_unique_id != expected_unique_id:
# If the id of the device does not match the unique_id
# of the config entry, it likely means the DHCP lease has expired
# and the device has been assigned a new IP address. We need to
# wait for the next discovery to find the device at its new address
# and update the config entry so we do not mix up devices.
raise ConfigEntryNotReady(
f"Unexpected device found at {device.host}; "
f"expected {entry.unique_id}, found {found_unique_id}"
f"expected {expected_unique_id}, found {found_unique_id}"
)

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
Expand Down

0 comments on commit 3dfaa6a

Please sign in to comment.