mirror of
https://github.com/home-assistant/core.git
synced 2026-09-24 23:41:48 -05:00
Adapt esphome to new device registry API (#176942)
This commit is contained in:
@@ -121,13 +121,15 @@ def async_static_info_updated(
|
||||
# Update device assignment in registry
|
||||
if info.device_id:
|
||||
# Entity now belongs to a sub device
|
||||
new_device = dev_reg.async_get_device(
|
||||
identifiers={(DOMAIN, f"{device_info.mac_address}_{info.device_id}")}
|
||||
new_device = dev_reg.async_get_device_by_identifier(
|
||||
(DOMAIN, f"{device_info.mac_address}_{info.device_id}"),
|
||||
entry_data.entry_id,
|
||||
)
|
||||
else:
|
||||
# Entity now belongs to the main device
|
||||
new_device = dev_reg.async_get_device(
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, device_info.mac_address)}
|
||||
new_device = dev_reg.async_get_device_by_connection(
|
||||
(dr.CONNECTION_NETWORK_MAC, device_info.mac_address),
|
||||
entry_data.entry_id,
|
||||
)
|
||||
|
||||
if new_device:
|
||||
|
||||
Reference in New Issue
Block a user