Fix Mac address check in kef integration (#107746)

Fix the check for Mac address in kef integration (#106072)

It might be due to an update of `getmac` dependency in some case the mac
was resolved to "00:00:00:00:00:00" instead of the anticipated `None`.
With that the original bug #47678 where a duplicated entity would be
created in case of HA is restarted while the KEF speaker is offline
came back. The PR #52902 was applied back in time to fix that issue.
Now, this change is a continuation of the previous efforts. The solution
was tested for about two months and it does address the bug with
creating duplicated entities in case of KEF speakers being offline.
This commit is contained in:
Eugene Tiutiunnyk 2024-01-10 14:23:40 -08:00 committed by GitHub
parent 350806c036
commit 1bb76e2351
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -118,7 +118,7 @@ async def async_setup_platform(
mode = get_ip_mode(host) mode = get_ip_mode(host)
mac = await hass.async_add_executor_job(partial(get_mac_address, **{mode: host})) mac = await hass.async_add_executor_job(partial(get_mac_address, **{mode: host}))
if mac is None: if mac is None or mac == "00:00:00:00:00:00":
raise PlatformNotReady("Cannot get the ip address of kef speaker.") raise PlatformNotReady("Cannot get the ip address of kef speaker.")
unique_id = f"kef-{mac}" unique_id = f"kef-{mac}"