1 """Commands part of Websocket API."""
3 from __future__
import annotations
5 from collections.abc
import Callable
6 from functools
import lru_cache, partial
9 from typing
import Any, cast
11 import voluptuous
as vol
19 SIGNAL_BOOTSTRAP_INTEGRATIONS,
24 EventStateChangedData,
33 ServiceValidationError,
40 INCLUDE_EXCLUDE_BASE_FILTER_SCHEMA,
41 convert_include_exclude_filter,
46 async_track_template_result,
51 find_paths_unserializable_data,
58 async_get_integration,
59 async_get_integration_descriptions,
60 async_get_integrations,
65 from .
import const, decorators, messages
66 from .connection
import ActiveConnection
67 from .messages
import construct_result_message
69 ALL_SERVICE_DESCRIPTIONS_JSON_CACHE =
"websocket_api_all_service_descriptions_json"
71 _LOGGER = logging.getLogger(__name__)
77 async_reg: Callable[[HomeAssistant, const.WebSocketCommandHandler],
None],
79 """Register commands."""
80 async_reg(hass, handle_call_service)
81 async_reg(hass, handle_entity_source)
82 async_reg(hass, handle_execute_script)
83 async_reg(hass, handle_fire_event)
84 async_reg(hass, handle_get_config)
85 async_reg(hass, handle_get_services)
86 async_reg(hass, handle_get_states)
87 async_reg(hass, handle_manifest_get)
88 async_reg(hass, handle_integration_setup_info)
89 async_reg(hass, handle_manifest_list)
90 async_reg(hass, handle_ping)
91 async_reg(hass, handle_render_template)
92 async_reg(hass, handle_subscribe_bootstrap_integrations)
93 async_reg(hass, handle_subscribe_events)
94 async_reg(hass, handle_subscribe_trigger)
95 async_reg(hass, handle_test_condition)
96 async_reg(hass, handle_unsubscribe_events)
97 async_reg(hass, handle_validate_config)
98 async_reg(hass, handle_subscribe_entities)
99 async_reg(hass, handle_supported_features)
100 async_reg(hass, handle_integration_descriptions)
104 """Return a pong message."""
105 return {
"id": iden,
"type":
"pong"}
110 send_message: Callable[[bytes | str | dict[str, Any]],
None],
112 message_id_as_bytes: bytes,
115 """Forward state changed events to websocket."""
118 permissions = user.permissions
121 and not permissions.access_all_entities(POLICY_READ)
122 and not permissions.check_entity(event.data[
"entity_id"], POLICY_READ)
125 send_message(messages.cached_event_message(message_id_as_bytes, event))
130 send_message: Callable[[bytes | str | dict[str, Any]],
None],
131 message_id_as_bytes: bytes,
134 """Forward events to websocket."""
135 send_message(messages.cached_event_message(message_id_as_bytes, event))
139 @decorators.websocket_command(
{
vol.Required("type"):
"subscribe_events",
140 vol.Optional(
"event_type", default=MATCH_ALL): str,
144 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
146 """Handle subscribe events command."""
147 event_type = msg[
"event_type"]
149 if event_type
not in SUBSCRIBE_ALLOWLIST
and not connection.user.is_admin:
151 "Refusing to allow %s to subscribe to event %s",
152 connection.user.name,
157 message_id_as_bytes =
str(msg[
"id"]).encode()
159 if event_type == EVENT_STATE_CHANGED:
160 forward_events = partial(
161 _forward_events_check_permissions,
162 connection.send_message,
167 forward_events = partial(
168 _forward_events_unconditional, connection.send_message, message_id_as_bytes
171 connection.subscriptions[msg[
"id"]] = hass.bus.async_listen(
172 event_type, forward_events
175 connection.send_result(msg[
"id"])
179 @decorators.websocket_command(
{
vol.Required("type"):
"subscribe_bootstrap_integrations",
183 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
185 """Handle subscribe bootstrap integrations command."""
188 def forward_bootstrap_integrations(message: dict[str, Any]) ->
None:
189 """Forward bootstrap integrations to websocket."""
190 connection.send_message(messages.event_message(msg[
"id"], message))
193 hass, SIGNAL_BOOTSTRAP_INTEGRATIONS, forward_bootstrap_integrations
196 connection.send_result(msg[
"id"])
200 @decorators.websocket_command(
{
vol.Required("type"):
"unsubscribe_events",
201 vol.Required(
"subscription"): cv.positive_int,
205 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
207 """Handle unsubscribe events command."""
208 subscription = msg[
"subscription"]
210 if subscription
in connection.subscriptions:
211 connection.subscriptions.pop(subscription)()
212 connection.send_result(msg[
"id"])
214 connection.send_error(msg[
"id"], const.ERR_NOT_FOUND,
"Subscription not found.")
217 @decorators.websocket_command(
{
vol.Required("type"):
"call_service",
218 vol.Required(
"domain"): str,
219 vol.Required(
"service"): str,
220 vol.Optional(
"target"): cv.ENTITY_SERVICE_FIELDS,
221 vol.Optional(
"service_data"): dict,
222 vol.Optional(
"return_response", default=
False): bool,
225 @decorators.async_response
227 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
229 """Handle call service command."""
231 target = msg.get(
"target")
232 if template.is_complex(target):
233 raise vol.Invalid(
"Templates are not supported here")
236 context = connection.context(msg)
237 response = await hass.services.async_call(
238 domain=msg[
"domain"],
239 service=msg[
"service"],
240 service_data=msg.get(
"service_data"),
244 return_response=msg[
"return_response"],
246 result: dict[str, Context | ServiceResponse] = {
"context": context}
247 if msg[
"return_response"]:
248 result[
"response"] = response
249 connection.send_result(msg[
"id"], result)
250 except ServiceNotFound
as err:
251 if err.domain == msg[
"domain"]
and err.service == msg[
"service"]:
252 connection.send_error(
255 f
"Service {err.domain}.{err.service} not found.",
256 translation_domain=err.translation_domain,
257 translation_key=err.translation_key,
258 translation_placeholders=err.translation_placeholders,
262 connection.send_error(
264 const.ERR_HOME_ASSISTANT_ERROR,
265 f
"Service {err.domain}.{err.service} called service "
266 f
"{msg['domain']}.{msg['service']} which was not found.",
267 translation_domain=const.DOMAIN,
268 translation_key=
"child_service_not_found",
269 translation_placeholders={
270 "domain": err.domain,
271 "service": err.service,
272 "child_domain": msg[
"domain"],
273 "child_service": msg[
"service"],
276 except vol.Invalid
as err:
277 connection.send_error(msg[
"id"], const.ERR_INVALID_FORMAT,
str(err))
278 except ServiceValidationError
as err:
279 connection.logger.error(err)
280 connection.logger.debug(
"", exc_info=err)
281 connection.send_error(
283 const.ERR_SERVICE_VALIDATION_ERROR,
284 f
"Validation error: {err}",
285 translation_domain=err.translation_domain,
286 translation_key=err.translation_key,
287 translation_placeholders=err.translation_placeholders,
289 except HomeAssistantError
as err:
290 connection.logger.exception(
"Unexpected exception")
291 connection.send_error(
293 const.ERR_HOME_ASSISTANT_ERROR,
295 translation_domain=err.translation_domain,
296 translation_key=err.translation_key,
297 translation_placeholders=err.translation_placeholders,
299 except Exception
as err:
300 connection.logger.exception(
"Unexpected exception")
301 connection.send_error(msg[
"id"], const.ERR_UNKNOWN_ERROR,
str(err))
306 hass: HomeAssistant, connection: ActiveConnection
308 user = connection.user
309 if user.is_admin
or user.permissions.access_all_entities(POLICY_READ):
310 return hass.states.async_all()
311 entity_perm = connection.user.permissions.check_entity
314 for state
in hass.states.async_all()
315 if entity_perm(state.entity_id, POLICY_READ)
320 @decorators.websocket_command({vol.Required("type"):
"get_states"})
322 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
324 """Handle get states command."""
328 serialized_states = [state.as_dict_json
for state
in states]
329 except (ValueError, TypeError):
336 serialized_states = []
339 serialized_states.append(state.as_dict_json)
340 except (ValueError, TypeError):
341 connection.logger.error(
342 "Unable to serialize to JSON. Bad data found at %s",
352 connection: ActiveConnection, msg_id: int, serialized_states: list[bytes]
354 """Send handle get states response."""
355 connection.send_message(
357 msg_id, b
"".join((b
"[", b
",".join(serialized_states), b
"]"))
364 send_message: Callable[[str | bytes | dict[str, Any]],
None],
365 entity_ids: set[str] |
None,
366 entity_filter: Callable[[str], bool] |
None,
368 message_id_as_bytes: bytes,
369 event: Event[EventStateChangedData],
371 """Forward entity state changed events to websocket."""
372 entity_id = event.data[
"entity_id"]
373 if (entity_ids
and entity_id
not in entity_ids)
or (
374 entity_filter
and not entity_filter(entity_id)
379 permissions = user.permissions
382 and not permissions.access_all_entities(POLICY_READ)
383 and not permissions.check_entity(entity_id, POLICY_READ)
386 send_message(messages.cached_state_diff_message(message_id_as_bytes, event))
390 @decorators.websocket_command(
{
vol.Required("type"):
"subscribe_entities",
391 vol.Optional(
"entity_ids"): cv.entity_ids,
392 **INCLUDE_EXCLUDE_BASE_FILTER_SCHEMA.schema,
396 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
398 """Handle subscribe entities command."""
399 entity_ids = set(msg.get(
"entity_ids", []))
or None
401 entity_filter =
None if _filter.empty_filter
else _filter.get_filter()
407 message_id_as_bytes =
str(msg_id).encode()
408 connection.subscriptions[msg_id] = hass.bus.async_listen(
411 _forward_entity_changes,
412 connection.send_message,
419 connection.send_result(msg_id)
425 if entity_ids
or entity_filter:
426 serialized_states = [
427 state.as_compressed_state_json
429 if (
not entity_ids
or state.entity_id
in entity_ids)
430 and (
not entity_filter
or entity_filter(state.entity_id))
434 serialized_states = [state.as_compressed_state_json
for state
in states]
435 except (ValueError, TypeError):
439 connection, message_id_as_bytes, serialized_states
443 serialized_states = []
446 serialized_states.append(state.as_compressed_state_json)
447 except (ValueError, TypeError):
448 connection.logger.error(
449 "Unable to serialize to JSON. Bad data found at %s",
456 connection, message_id_as_bytes, serialized_states
461 connection: ActiveConnection,
462 message_id_as_bytes: bytes,
463 serialized_states: list[bytes],
465 """Send handle entities init response."""
466 connection.send_message(
471 b
',"type":"event","event":{"a":{',
472 b
",".join(serialized_states),
480 """Return JSON of descriptions (i.e. user documentation) for all service calls."""
482 if ALL_SERVICE_DESCRIPTIONS_JSON_CACHE
in hass.data:
483 cached_descriptions, cached_json_payload = hass.data[
484 ALL_SERVICE_DESCRIPTIONS_JSON_CACHE
487 if cached_descriptions
is descriptions:
488 return cast(bytes, cached_json_payload)
490 hass.data[ALL_SERVICE_DESCRIPTIONS_JSON_CACHE] = (descriptions, json_payload)
494 @decorators.websocket_command({vol.Required("type"):
"get_services"})
495 @decorators.async_response
497 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
499 """Handle get services command."""
505 @decorators.websocket_command({vol.Required("type"):
"get_config"})
507 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
509 """Handle get config command."""
510 connection.send_result(msg[
"id"], hass.config.as_dict())
513 @decorators.websocket_command(
{vol.Required("type"):
"manifest/list", vol.Optional(
"integrations"): [str]}
515 @decorators.async_response
517 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
519 """Handle integrations command."""
523 manifest_json_fragments: list[json_fragment] = []
524 for int_or_exc
in ints_or_excs.values():
525 if isinstance(int_or_exc, Exception):
527 manifest_json_fragments.append(int_or_exc.manifest_json_fragment)
528 connection.send_result(msg[
"id"], manifest_json_fragments)
531 @decorators.websocket_command(
{vol.Required("type"):
"manifest/get", vol.Required(
"integration"): str}
533 @decorators.async_response
535 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
537 """Handle integrations command."""
540 except IntegrationNotFound:
541 connection.send_error(msg[
"id"], const.ERR_NOT_FOUND,
"Integration not found")
543 connection.send_result(msg[
"id"], integration.manifest_json_fragment)
547 @decorators.websocket_command({vol.Required("type"):
"integration/setup_info"})
549 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
551 """Handle integrations command."""
552 connection.send_result(
555 {
"domain": integration,
"seconds": seconds}
562 @decorators.websocket_command({vol.Required("type"):
"ping"})
564 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
566 """Handle ping command."""
571 def _cached_template(template_str: str, hass: HomeAssistant) -> template.Template:
572 """Return a cached template."""
573 return template.Template(template_str, hass)
576 @decorators.websocket_command(
{
vol.Required("type"):
"render_template",
577 vol.Required(
"template"): str,
578 vol.Optional(
"entity_ids"): cv.entity_ids,
579 vol.Optional(
"variables"): dict,
580 vol.Optional(
"timeout"): vol.Coerce(float),
581 vol.Optional(
"strict", default=
False): bool,
582 vol.Optional(
"report_errors", default=
False): bool,
585 @decorators.async_response
587 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
589 """Handle render_template command."""
590 template_str = msg[
"template"]
591 report_errors: bool = msg[
"report_errors"]
593 template_obj = template.Template(template_str, hass)
596 variables = msg.get(
"variables")
597 timeout = msg.get(
"timeout")
600 def _error_listener(level: int, template_error: str) ->
None:
601 connection.send_message(
602 messages.event_message(
604 {
"error": template_error,
"level": logging.getLevelName(level)},
609 def _thread_safe_error_listener(level: int, template_error: str) ->
None:
610 hass.loop.call_soon_threadsafe(_error_listener, level, template_error)
614 log_fn = _thread_safe_error_listener
if report_errors
else None
615 timed_out = await template_obj.async_render_will_timeout(
616 timeout, variables, strict=msg[
"strict"], log_fn=log_fn
618 except TemplateError:
622 connection.send_error(
624 const.ERR_TEMPLATE_ERROR,
625 f
"Exceeded maximum execution time of {timeout}s",
630 def _template_listener(
631 event: Event[EventStateChangedData] |
None,
632 updates: list[TrackTemplateResult],
634 track_template_result = updates.pop()
635 result = track_template_result.result
636 if isinstance(result, TemplateError):
637 if not report_errors:
639 connection.send_message(
640 messages.event_message(
641 msg[
"id"], {
"error":
str(result),
"level":
"ERROR"}
646 connection.send_message(
647 messages.event_message(
648 msg[
"id"], {
"result": result,
"listeners": info.listeners}
653 log_fn = _error_listener
if report_errors
else None
658 strict=msg[
"strict"],
661 except TemplateError
as ex:
662 connection.send_error(msg[
"id"], const.ERR_TEMPLATE_ERROR,
str(ex))
665 connection.subscriptions[msg[
"id"]] = info.async_remove
667 connection.send_result(msg[
"id"])
669 hass.loop.call_soon_threadsafe(info.async_refresh)
673 entity_infos: dict[str, entity.EntityInfo],
675 """Prepare a websocket response from a dict of entity sources."""
677 entity_id: {
"domain": entity_info[
"domain"]}
678 for entity_id, entity_info
in entity_infos.items()
683 @decorators.websocket_command({vol.Required("type"):
"entity/source"})
685 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
687 """Handle entity source command."""
688 all_entity_sources = entity.entity_sources(hass)
689 entity_perm = connection.user.permissions.check_entity
691 if connection.user.permissions.access_all_entities(POLICY_READ):
692 entity_sources = all_entity_sources
696 for entity_id, source
in all_entity_sources.items()
697 if entity_perm(entity_id, POLICY_READ)
703 @decorators.websocket_command(
{
vol.Required("type"):
"subscribe_trigger",
704 vol.Required(
"trigger"): cv.TRIGGER_SCHEMA,
705 vol.Optional(
"variables"): dict,
708 @decorators.require_admin
709 @decorators.async_response
711 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
713 """Handle subscribe trigger command."""
718 trigger_config = await trigger.async_validate_trigger_config(hass, msg[
"trigger"])
721 def forward_triggers(
722 variables: dict[str, Any], context: Context |
None =
None
724 """Forward events to websocket."""
725 message = messages.event_message(
726 msg[
"id"], {
"variables": variables,
"context": context}
728 connection.send_message(
730 message, cls=ExtendedJSONEncoder, allow_nan=
False, separators=(
",",
":")
734 connection.subscriptions[msg[
"id"]] = (
735 await trigger.async_initialize_triggers(
741 connection.logger.log,
742 variables=msg.get(
"variables"),
749 connection.send_result(msg[
"id"])
752 @decorators.websocket_command(
{
vol.Required("type"):
"test_condition",
753 vol.Required(
"condition"): cv.CONDITION_SCHEMA,
754 vol.Optional(
"variables"): dict,
757 @decorators.require_admin
758 @decorators.async_response
760 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
762 """Handle test condition command."""
768 config = await condition.async_validate_condition_config(hass, msg[
"condition"])
770 check_condition = await condition.async_from_config(hass, config)
771 connection.send_result(
772 msg[
"id"], {
"result": check_condition(hass, msg.get(
"variables"))}
776 @decorators.websocket_command(
{
vol.Required("type"):
"execute_script",
777 vol.Required(
"sequence"): cv.SCRIPT_SCHEMA,
778 vol.Optional(
"variables"): dict,
781 @decorators.require_admin
782 @decorators.async_response
784 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
786 """Handle execute script command."""
793 context = connection.context(msg)
794 script_obj = Script(hass, script_config, f
"{const.DOMAIN} script", const.DOMAIN)
796 script_result = await script_obj.async_run(
797 msg.get(
"variables"), context=context
799 except ServiceValidationError
as err:
800 connection.logger.error(err)
801 connection.logger.debug(
"", exc_info=err)
802 connection.send_error(
804 const.ERR_SERVICE_VALIDATION_ERROR,
806 translation_domain=err.translation_domain,
807 translation_key=err.translation_key,
808 translation_placeholders=err.translation_placeholders,
811 connection.send_result(
815 "response": script_result.service_response
if script_result
else None,
821 @decorators.websocket_command(
{
vol.Required("type"):
"fire_event",
822 vol.Required(
"event_type"): str,
823 vol.Optional(
"event_data"): dict,
826 @decorators.require_admin
828 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
830 """Handle fire event command."""
831 context = connection.context(msg)
833 hass.bus.async_fire(msg[
"event_type"], msg.get(
"event_data"), context=context)
834 connection.send_result(msg[
"id"], {
"context": context})
837 @decorators.websocket_command(
{
vol.Required("type"):
"validate_config",
838 vol.Optional(
"triggers"): cv.match_all,
839 vol.Optional(
"conditions"): cv.match_all,
840 vol.Optional(
"actions"): cv.match_all,
843 @decorators.async_response
845 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
847 """Handle validate config command."""
854 for key, schema, validator
in (
855 (
"triggers", cv.TRIGGER_SCHEMA, trigger.async_validate_trigger_config),
858 cv.CONDITIONS_SCHEMA,
859 condition.async_validate_conditions_config,
861 (
"actions", cv.SCRIPT_SCHEMA, script.async_validate_actions_config),
867 await validator(hass, schema(msg[key]))
872 result[key] = {
"valid":
False,
"error":
str(err)}
874 result[key] = {
"valid":
True,
"error":
None}
876 connection.send_result(msg[
"id"], result)
880 @decorators.websocket_command(
{
vol.Required("type"):
"supported_features",
881 vol.Required(
"features"): {str: int},
885 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
887 """Handle setting supported features."""
888 connection.set_supported_features(msg[
"features"])
889 connection.send_result(msg[
"id"])
892 @decorators.require_admin
893 @decorators.websocket_command({"type": "integration/descriptions"})
894 @decorators.async_response
896 hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
898 """Get metadata for all brands and integrations."""
900
None handle_get_config(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
list[State] _async_get_allowed_states(HomeAssistant hass, ActiveConnection connection)
None handle_manifest_list(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
None handle_get_services(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
template.Template _cached_template(str template_str, HomeAssistant hass)
None _forward_entity_changes(Callable[[str|bytes|dict[str, Any]], None] send_message, set[str]|None entity_ids, Callable[[str], bool]|None entity_filter, User user, bytes message_id_as_bytes, Event[EventStateChangedData] event)
None handle_render_template(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
None handle_subscribe_bootstrap_integrations(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
None handle_execute_script(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
None handle_integration_setup_info(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
None handle_ping(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
None handle_unsubscribe_events(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
None handle_fire_event(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
None handle_test_condition(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
dict[str, Any] pong_message(int iden)
None _send_handle_get_states_response(ActiveConnection connection, int msg_id, list[bytes] serialized_states)
None handle_supported_features(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
None handle_subscribe_events(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
dict[str, Any] _serialize_entity_sources(dict[str, entity.EntityInfo] entity_infos)
None handle_manifest_get(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
bytes _async_get_all_descriptions_json(HomeAssistant hass)
None handle_call_service(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
None async_register_commands(HomeAssistant hass, Callable[[HomeAssistant, const .WebSocketCommandHandler], None] async_reg)
None handle_entity_source(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
None _send_handle_entities_init_response(ActiveConnection connection, bytes message_id_as_bytes, list[bytes] serialized_states)
None _forward_events_check_permissions(Callable[[bytes|str|dict[str, Any]], None] send_message, User user, bytes message_id_as_bytes, Event event)
None handle_subscribe_entities(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
None handle_get_states(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
None handle_subscribe_trigger(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
None handle_validate_config(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
None _forward_events_unconditional(Callable[[bytes|str|dict[str, Any]], None] send_message, bytes message_id_as_bytes, Event event)
None handle_integration_descriptions(HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
bytes construct_result_message(int iden, bytes payload)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)
EntityFilter convert_include_exclude_filter(dict[str, dict[str, list[str]]] config)
TrackTemplateResultInfo async_track_template_result(HomeAssistant hass, Sequence[TrackTemplate] track_templates, TrackTemplateResultListener action, bool strict=False, Callable[[int, str], None]|None log_fn=None, bool has_super_template=False)
dict[str, Any] find_paths_unserializable_data(Any bad_data, *Callable[[Any], str] dump=json.dumps)
list[ConfigType] async_validate_actions_config(HomeAssistant hass, list[ConfigType] actions)
dict[str, dict[str, Any]] async_get_all_descriptions(HomeAssistant hass)
dict[str, Integration|Exception] async_get_integrations(HomeAssistant hass, Iterable[str] domains)
dict[str, Any] async_get_integration_descriptions(HomeAssistant hass)
Integration async_get_integration(HomeAssistant hass, str domain)
set[str] async_get_loaded_integrations(core.HomeAssistant hass)
dict[str, float] async_get_setup_timings(core.HomeAssistant hass)
str format_unserializable_data(dict[str, Any] data)