Add missed components

This commit is contained in:
abmantis 2025-07-03 23:24:01 +01:00
parent a971313a9d
commit 695f47c5fc
4 changed files with 30 additions and 13 deletions

View File

@ -42,9 +42,12 @@ from homeassistant.helpers import (
)
from homeassistant.helpers.entity_component import async_update_entity
from homeassistant.helpers.issue_registry import IssueSeverity
from homeassistant.helpers.selector import (
TargetSelectorData,
async_extract_referenced_entity_ids,
)
from homeassistant.helpers.service import (
async_extract_config_entry_ids,
async_extract_referenced_entity_ids,
async_register_admin_service,
)
from homeassistant.helpers.signal import KEY_HA_STOP
@ -111,7 +114,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
async def async_handle_turn_service(service: ServiceCall) -> None:
"""Handle calls to homeassistant.turn_on/off."""
referenced = async_extract_referenced_entity_ids(hass, service)
referenced = async_extract_referenced_entity_ids(
hass, TargetSelectorData(service.data)
)
all_referenced = referenced.referenced | referenced.indirectly_referenced
# Generic turn on/off method requires entity id

View File

@ -75,10 +75,11 @@ from homeassistant.helpers.entityfilter import (
EntityFilter,
)
from homeassistant.helpers.reload import async_integration_yaml_config
from homeassistant.helpers.service import (
from homeassistant.helpers.selector import (
TargetSelectorData,
async_extract_referenced_entity_ids,
async_register_admin_service,
)
from homeassistant.helpers.service import async_register_admin_service
from homeassistant.helpers.start import async_at_started
from homeassistant.helpers.typing import ConfigType
from homeassistant.loader import IntegrationNotFound, async_get_integration
@ -482,7 +483,9 @@ def _async_register_events_and_services(hass: HomeAssistant) -> None:
async def async_handle_homekit_unpair(service: ServiceCall) -> None:
"""Handle unpair HomeKit service call."""
referenced = async_extract_referenced_entity_ids(hass, service)
referenced = async_extract_referenced_entity_ids(
hass, TargetSelectorData(service.data)
)
dev_reg = dr.async_get(hass)
for device_id in referenced.referenced_devices:
if not (dev_reg_ent := dev_reg.async_get(device_id)):

View File

@ -28,7 +28,10 @@ from homeassistant.components.light import (
from homeassistant.const import ATTR_MODE
from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.service import async_extract_referenced_entity_ids
from homeassistant.helpers.selector import (
TargetSelectorData,
async_extract_referenced_entity_ids,
)
from .const import _ATTR_COLOR_TEMP, ATTR_THEME, DOMAIN
from .coordinator import LIFXConfigEntry, LIFXUpdateCoordinator
@ -268,7 +271,9 @@ class LIFXManager:
async def service_handler(service: ServiceCall) -> None:
"""Apply a service, i.e. start an effect."""
referenced = async_extract_referenced_entity_ids(self.hass, service)
referenced = async_extract_referenced_entity_ids(
self.hass, TargetSelectorData(service.data)
)
all_referenced = referenced.referenced | referenced.indirectly_referenced
if all_referenced:
await self.start_effect(all_referenced, service.service, **service.data)
@ -499,6 +504,5 @@ class LIFXManager:
if self.entry_id_to_entity_id[entry.entry_id] in entity_ids:
coordinators.append(entry.runtime_data)
bulbs.append(entry.runtime_data.device)
if start_effect_func := self._effect_dispatch.get(service):
await start_effect_func(self, bulbs, coordinators, **kwargs)

View File

@ -26,7 +26,10 @@ from homeassistant.helpers import (
device_registry as dr,
entity_registry as er,
)
from homeassistant.helpers.service import async_extract_referenced_entity_ids
from homeassistant.helpers.selector import (
TargetSelectorData,
async_extract_referenced_entity_ids,
)
from homeassistant.util.json import JsonValueType
from homeassistant.util.read_only_dict import ReadOnlyDict
@ -115,7 +118,7 @@ def _async_get_ufp_instance(hass: HomeAssistant, device_id: str) -> ProtectApiCl
@callback
def _async_get_ufp_camera(call: ServiceCall) -> Camera:
ref = async_extract_referenced_entity_ids(call.hass, call)
ref = async_extract_referenced_entity_ids(call.hass, TargetSelectorData(call.data))
entity_registry = er.async_get(call.hass)
entity_id = ref.indirectly_referenced.pop()
@ -133,7 +136,7 @@ def _async_get_protect_from_call(call: ServiceCall) -> set[ProtectApiClient]:
return {
_async_get_ufp_instance(call.hass, device_id)
for device_id in async_extract_referenced_entity_ids(
call.hass, call
call.hass, TargetSelectorData(call.data)
).referenced_devices
}
@ -196,7 +199,7 @@ def _async_unique_id_to_mac(unique_id: str) -> str:
async def set_chime_paired_doorbells(call: ServiceCall) -> None:
"""Set paired doorbells on chime."""
ref = async_extract_referenced_entity_ids(call.hass, call)
ref = async_extract_referenced_entity_ids(call.hass, TargetSelectorData(call.data))
entity_registry = er.async_get(call.hass)
entity_id = ref.indirectly_referenced.pop()
@ -211,7 +214,9 @@ async def set_chime_paired_doorbells(call: ServiceCall) -> None:
assert chime is not None
call.data = ReadOnlyDict(call.data.get("doorbells") or {})
doorbell_refs = async_extract_referenced_entity_ids(call.hass, call)
doorbell_refs = async_extract_referenced_entity_ids(
call.hass, TargetSelectorData(call.data)
)
doorbell_ids: set[str] = set()
for camera_id in doorbell_refs.referenced | doorbell_refs.indirectly_referenced:
doorbell_sensor = entity_registry.async_get(camera_id)