Prevent get_mac_address from blocking event loop in samsungtv config flow (#60246)

pull/60265/head
J. Nick Koston 2021-11-23 20:16:09 -06:00 committed by GitHub
parent e1de6612be
commit be94ce42a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,7 @@
"""Config flow for Samsung TV."""
from __future__ import annotations
from functools import partial
import socket
from types import MappingProxyType
from typing import Any
@ -167,7 +168,9 @@ class SamsungTVConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
self._udn = _strip_uuid(dev_info.get("udn", info["id"]))
if mac := mac_from_device_info(info):
self._mac = mac
elif mac := getmac.get_mac_address(ip=self._host):
elif mac := await self.hass.async_add_executor_job(
partial(getmac.get_mac_address, ip=self._host)
):
self._mac = mac
self._device_info = info
return True