def _async_get_hm_device_by_service_data(hass: HomeAssistant, service: ServiceCall) -> Device | None:
    """Service to force device availability on a Homematic(IP) Local devices."""
    hm_device: Device | None = None
    message = "No device found"

    if device_id := service.data.get(CONF_DEVICE_ID):
        hm_device = _asnyc_get_hm_device_by_id(hass=hass, device_id=device_id)
        if not hm_device:
            message = f"No device found by device_id {device_id} for service {service.domain}.{service.service}"
    elif device_address := service.data.get(CONF_DEVICE_ADDRESS):
        hm_device = _async_get_hm_device_by_address(hass=hass, device_address=device_address)
        if not hm_device:
            message = (
                f"No device found by device_address {device_address} for service {service.domain}.{service.service}"
            )
    elif channel_address := service.data.get(CONF_CHANNEL_ADDRESS):
        hm_device = _async_get_hm_device_by_address(
            hass=hass, device_address=get_device_address(address=channel_address)
        )
        if not hm_device:
            message = (
                f"No device found by channel_address {channel_address} for service {service.domain}.{service.service}"
            )
    elif receiver_channel_address := service.data.get(CONF_RECEIVER_CHANNEL_ADDRESS):
        hm_device = _async_get_hm_device_by_address(
            hass=hass, device_address=get_device_address(address=receiver_channel_address)
        )
        if not hm_device:
            message = f"No device found by receiver_channel_address {receiver_channel_address} for service {service.domain}.{service.service}"
    if not hm_device:
        _LOGGER.warning(message)
        raise HomeAssistantError(message)
    return hm_device
Service to force device availability on a Homematic(IP) Local devices.
custom_components/homematicip_local/services.py