Skip to content

Commit a89cac5

Browse files
committed
Add missing __call__methods to Service and AsyncService
1 parent d6314de commit a89cac5

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

homeassistant_api/models/domains.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,15 @@ def trigger(
630630
**service_data,
631631
)
632632

633+
def __call__(self, **service_data: Any) -> (
634+
tuple[State, ...]
635+
| tuple[tuple[State, ...], dict[str, Any]]
636+
| dict[str, Any]
637+
| None
638+
):
639+
"""Calls the service associated with this object."""
640+
return self.trigger(**service_data)
641+
633642

634643
class AsyncService(BaseService):
635644
"""Async service with async trigger method."""
@@ -658,3 +667,12 @@ async def trigger(
658667
self.service_id,
659668
**service_data,
660669
)
670+
671+
async def __call__(self, **service_data: Any) -> (
672+
tuple[State, ...]
673+
| tuple[tuple[State, ...], dict[str, Any]]
674+
| dict[str, Any]
675+
| None
676+
):
677+
"""Calls the service associated with this object."""
678+
return await self.trigger(**service_data)

0 commit comments

Comments
 (0)