Public Member Functions | |
| None | __init__ (self, HomeAssistant hass) |
| ServiceResponse | async_call (self, str domain, str service, dict[str, Any]|None service_data=None, bool blocking=False, Context|None context=None, dict[str, Any]|None target=None, bool return_response=False) |
| None | async_register (self, str domain, str service, Callable[[ServiceCall], Coroutine[Any, Any, ServiceResponse|EntityServiceResponse]|ServiceResponse|EntityServiceResponse|None,] service_func, VolSchemaType|None schema=None, SupportsResponse supports_response=SupportsResponse.NONE, HassJobType|None job_type=None) |
| None | async_remove (self, str domain, str service) |
| dict[str, dict[str, Service]] | async_services (self) |
| dict[str, Service] | async_services_for_domain (self, str domain) |
| dict[str, dict[str, Service]] | async_services_internal (self) |
| ServiceResponse | call (self, str domain, str service, dict[str, Any]|None service_data=None, bool blocking=False, Context|None context=None, dict[str, Any]|None target=None, bool return_response=False) |
| bool | has_service (self, str domain, str service) |
| None | register (self, str domain, str service, Callable[[ServiceCall], Coroutine[Any, Any, ServiceResponse]|ServiceResponse|None,] service_func, vol.Schema|None schema=None, SupportsResponse supports_response=SupportsResponse.NONE) |
| None | remove (self, str domain, str service) |
| dict[str, dict[str, Service]] | services (self) |
| SupportsResponse | supports_response (self, str domain, str service) |
Private Member Functions | |
| None | _async_register (self, str domain, str service, Callable[[ServiceCall], Coroutine[Any, Any, ServiceResponse|EntityServiceResponse]|ServiceResponse|EntityServiceResponse|None,] service_func, VolSchemaType|None schema=None, SupportsResponse supports_response=SupportsResponse.NONE, HassJobType|None job_type=None) |
| None | _async_remove (self, str domain, str service) |
| ServiceResponse | _execute_service (self, Service handler, ServiceCall service_call) |
| None | _run_service_call_catch_exceptions (self, Coroutine[Any, Any, Any]|asyncio.Task[Any] coro_or_task, ServiceCall service_call) |
Private Attributes | |
| _hass | |
Static Private Attributes | |
| __slots__ | |
| None homeassistant.core.ServiceRegistry.__init__ | ( | self, | |
| HomeAssistant | hass | ||
| ) |
|
private |
|
private |
|
private |
|
private |
| ServiceResponse homeassistant.core.ServiceRegistry.async_call | ( | self, | |
| str | domain, | ||
| str | service, | ||
| dict[str, Any] | None | service_data = None, |
||
| bool | blocking = False, |
||
| Context | None | context = None, |
||
| dict[str, Any] | None | target = None, |
||
| bool | return_response = False |
||
| ) |
Call a service. Specify blocking=True to wait until service is executed. If return_response=True, indicates that the caller can consume return values from the service, if any. Return values are a dict that can be returned by the standard JSON serialization process. Return values can only be used with blocking=True. This method will fire an event to indicate the service has been called. Because the service is sent as an event you are not allowed to use the keys ATTR_DOMAIN and ATTR_SERVICE in your service_data. This method is a coroutine.
| None homeassistant.core.ServiceRegistry.async_register | ( | self, | |
| str | domain, | ||
| str | service, | ||
| Callable[ [ServiceCall], Coroutine[Any, Any, ServiceResponse | EntityServiceResponse] | ServiceResponse | EntityServiceResponse | None, ] | service_func, | ||
| VolSchemaType | None | schema = None, |
||
| SupportsResponse | supports_response = SupportsResponse.NONE, |
||
| HassJobType | None | job_type = None |
||
| ) |
| None homeassistant.core.ServiceRegistry.async_remove | ( | self, | |
| str | domain, | ||
| str | service | ||
| ) |
| dict[str, dict[str, Service]] homeassistant.core.ServiceRegistry.async_services | ( | self | ) |
| dict[str, Service] homeassistant.core.ServiceRegistry.async_services_for_domain | ( | self, | |
| str | domain | ||
| ) |
| dict[str, dict[str, Service]] homeassistant.core.ServiceRegistry.async_services_internal | ( | self | ) |
Return dictionary with per domain a list of available services. This method DOES NOT make a copy of the services like async_services does. It is only expected to be called from the Home Assistant internals as a performance optimization when the caller is not going to modify the returned data. This method must be run in the event loop.
| ServiceResponse homeassistant.core.ServiceRegistry.call | ( | self, | |
| str | domain, | ||
| str | service, | ||
| dict[str, Any] | None | service_data = None, |
||
| bool | blocking = False, |
||
| Context | None | context = None, |
||
| dict[str, Any] | None | target = None, |
||
| bool | return_response = False |
||
| ) |
| bool homeassistant.core.ServiceRegistry.has_service | ( | self, | |
| str | domain, | ||
| str | service | ||
| ) |
| None homeassistant.core.ServiceRegistry.register | ( | self, | |
| str | domain, | ||
| str | service, | ||
| Callable[ [ServiceCall], Coroutine[Any, Any, ServiceResponse] | ServiceResponse | None, ] | service_func, | ||
| vol.Schema | None | schema = None, |
||
| SupportsResponse | supports_response = SupportsResponse.NONE |
||
| ) |
| None homeassistant.core.ServiceRegistry.remove | ( | self, | |
| str | domain, | ||
| str | service | ||
| ) |
| dict[str, dict[str, Service]] homeassistant.core.ServiceRegistry.services | ( | self | ) |
| SupportsResponse homeassistant.core.ServiceRegistry.supports_response | ( | self, | |
| str | domain, | ||
| str | service | ||
| ) |
Return whether or not the service supports response data. This exists so that callers can return more helpful error messages given the context. Will return NONE if the service does not exist as there is other error handling when calling the service if it does not exist.