mirror of
https://github.com/home-assistant/core.git
synced 2026-09-27 09:58:07 -04:00
Use get_device_and_config_entry_for_domain in teslemetry (#180115)
This commit is contained in:
@@ -88,10 +88,11 @@ def async_get_config_for_device(
|
||||
hass: HomeAssistant, device_entry: dr.DeviceEntry
|
||||
) -> TeslemetryConfigEntry:
|
||||
"""Get the config entry related to a device entry."""
|
||||
for entry_id in device_entry.config_entries:
|
||||
if entry := hass.config_entries.async_get_entry(entry_id):
|
||||
if entry.domain == DOMAIN:
|
||||
return entry
|
||||
_, config_entry = dr.async_get_device_and_config_entry_for_domain(
|
||||
hass, device_entry.id, domain=DOMAIN
|
||||
)
|
||||
if config_entry:
|
||||
return config_entry
|
||||
raise ServiceValidationError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="no_config_entry_for_device",
|
||||
|
||||
Reference in New Issue
Block a user