From 54082283cf8bbfda6cb4545c93cbb41b9fd274ec Mon Sep 17 00:00:00 2001 From: Artur Pragacz <49985303+arturpragacz@users.noreply.github.com> Date: Mon, 26 Oct 2026 12:43:50 +0100 Subject: [PATCH] Simplify overloads of async_get_device_and_config_entry helpers (#188429) --- homeassistant/helpers/device_registry.py | 4 ++-- homeassistant/helpers/service.py | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/homeassistant/helpers/device_registry.py b/homeassistant/helpers/device_registry.py index dbc2bb553ed6..7ee500b56719 100644 --- a/homeassistant/helpers/device_registry.py +++ b/homeassistant/helpers/device_registry.py @@ -4932,8 +4932,8 @@ def async_get_device_and_config_entry_for_domain( device_id: str, *, domain: str, - include_child_devices: Literal[True] = True, - include_main_devices: Literal[True] = True, + include_child_devices: bool = True, + include_main_devices: bool = True, ) -> tuple[AnyDeviceEntry | None, ConfigEntry | None]: ... diff --git a/homeassistant/helpers/service.py b/homeassistant/helpers/service.py index 65ce7bc92cac..f1c6b18d6ad1 100644 --- a/homeassistant/helpers/service.py +++ b/homeassistant/helpers/service.py @@ -1487,8 +1487,8 @@ def async_get_device_and_config_entry( domain: str, device_id: str, *, - include_child_devices: Literal[True] = True, - include_main_devices: Literal[True] = True, + include_child_devices: bool = True, + include_main_devices: bool = True, ) -> tuple[device_registry.AnyDeviceEntry, ConfigEntry]: ... @@ -1511,10 +1511,7 @@ def async_get_device_and_config_entry( as does a composite-device id, because both the splits of a composite and the restored composite itself are main devices. """ - device: device_registry.AnyDeviceEntry | None - config_entry: ConfigEntry | None - # The flags are plain bools here, which matches none of the Literal overloads - device, config_entry = device_registry.async_get_device_and_config_entry_for_domain( # type: ignore[call-overload] + device, config_entry = device_registry.async_get_device_and_config_entry_for_domain( hass, device_id, domain=domain,