Filter by connections instead of identifiers for Shelly (#58305)

* Fix connections

* Switch to helper
This commit is contained in:
Simone Chemelli 2021-10-24 09:51:02 +02:00 committed by GitHub
parent 30fb619095
commit da7e26c287
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,7 +132,13 @@ async def async_setup_block_entry(hass: HomeAssistant, entry: ConfigEntry) -> bo
device_entry = None
if entry.unique_id is not None:
device_entry = dev_reg.async_get_device(
identifiers={(DOMAIN, entry.unique_id)}, connections=set()
identifiers=set(),
connections={
(
device_registry.CONNECTION_NETWORK_MAC,
device_registry.format_mac(entry.unique_id),
)
},
)
if device_entry and entry.entry_id not in device_entry.config_entries:
device_entry = None