This commit is contained in:
paoloavezzano 2026-10-19 17:28:55 +02:00 • committed by GitHub
commit 7e57a50b74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -1,5 +1,6 @@
"""Utility functions for HA core."""
import inspect
import logging
from collections.abc import Awaitable, Callable
@ -80,10 +81,9 @@ def setup_service_call_interceptor(
call.data,
)
# Call original service handler with processed data
import asyncio
target = existing_service.job.target
if asyncio.iscoroutinefunction(target):
if inspect.iscoroutinefunction(target):
await target(call)
else:
target(call)

View file

@ -5,6 +5,7 @@ from __future__ import annotations
import asyncio
import datetime
import hashlib
import inspect
import logging
import zoneinfo
from copy import deepcopy
@ -3329,7 +3330,7 @@ class _AsyncSingleShotTimer:
"""Run the timer. Don't call this directly, use start() instead."""
await asyncio.sleep(self.delay)
if self.callback:
if asyncio.iscoroutinefunction(self.callback):
if inspect.iscoroutinefunction(self.callback):
await self.callback()
else:
self.callback()