mirror of
https://github.com/home-assistant/core.git
synced 2026-09-26 17:31:15 -04:00
Use get_device_and_config_entry_for_domain in nintendo_parental_controls (#180100)
This commit is contained in:
@@ -61,16 +61,14 @@ def async_setup_services(
|
||||
def _get_nintendo_device(hass: HomeAssistant, device_id: str) -> Device:
|
||||
"""Get the Nintendo device from a device ID."""
|
||||
config_entry: NintendoParentalControlsConfigEntry | None
|
||||
device = dr.async_get(hass).async_get(device_id)
|
||||
device, config_entry = dr.async_get_device_and_config_entry_for_domain(
|
||||
hass, device_id, domain=DOMAIN
|
||||
)
|
||||
if device is None:
|
||||
raise ServiceValidationError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="device_not_found",
|
||||
)
|
||||
for entry_id in device.config_entries:
|
||||
config_entry = hass.config_entries.async_get_entry(entry_id)
|
||||
if config_entry is not None and config_entry.domain == DOMAIN:
|
||||
break
|
||||
nintendo_device_id = None
|
||||
for identifier in device.identifiers:
|
||||
if identifier[0] == DOMAIN:
|
||||
|
||||
Reference in New Issue
Block a user