Public Member Functions | |
| None | __init__ (self, logging.Logger logger, str domain, HomeAssistant hass, timedelta scan_interval=DEFAULT_SCAN_INTERVAL) |
| list[_EntityT] | async_extract_from_service (self, ServiceCall service_call, bool expand_group=True) |
| ConfigType|None | async_prepare_reload (self, *bool skip_reset=False) |
| None | async_register_entity_service (self, str name, VolDictType|VolSchemaType|None schema, str|Callable[..., Any] func, list[int]|None required_features=None, SupportsResponse supports_response=SupportsResponse.NONE) |
| None | async_register_legacy_entity_service (self, str name, VolDictType|VolSchemaType schema, str|Callable[..., Any] func, list[int]|None required_features=None, SupportsResponse supports_response=SupportsResponse.NONE) |
| None | async_remove_entity (self, str entity_id) |
| None | async_setup (self, ConfigType config) |
| bool | async_setup_entry (self, ConfigEntry config_entry) |
| None | async_setup_platform (self, str platform_type, ConfigType platform_config, DiscoveryInfoType|None discovery_info=None) |
| bool | async_unload_entry (self, ConfigEntry config_entry) |
| Iterable[_EntityT] | entities (self) |
| _EntityT|None | get_entity (self, str entity_id) |
| None | register_shutdown (self) |
| None | setup (self, ConfigType config) |
Public Attributes | |
| add_entities | |
| async_add_entities | |
| config | |
| domain | |
| hass | |
| logger | |
| scan_interval | |
Private Member Functions | |
| None | _async_component_platform_discovered (self, str platform, dict[str, Any]|None info) |
| EntityPlatform | _async_init_entity_platform (self, str platform_type, ModuleType|None platform, timedelta|None scan_interval=None, str|None entity_namespace=None) |
| None | _async_reset (self) |
| None | _async_shutdown (self, Event event) |
Private Attributes | |
| _platforms | |
The EntityComponent manages platforms that manage entities. An example of an entity component is 'light', which manages platforms such as 'hue.light'. This class has the following responsibilities: - Process the configuration and set up a platform based component, for example light. - Manage the platforms and their entities. - Help extract the entities from a service call. - Listen for discovery events for platforms related to the domain.
Definition at line 67 of file entity_component.py.
| None homeassistant.helpers.entity_component.EntityComponent.__init__ | ( | self, | |
| logging.Logger | logger, | ||
| str | domain, | ||
| HomeAssistant | hass, | ||
| timedelta | scan_interval = DEFAULT_SCAN_INTERVAL |
||
| ) |
Initialize an entity component.
Definition at line 80 of file entity_component.py.
|
private |
Handle the loading of a platform.
Definition at line 162 of file entity_component.py.
|
private |
Initialize an entity platform.
Definition at line 372 of file entity_component.py.
|
private |
Remove entities and reset the entity component to initial values. This method must be run in the event loop.
Definition at line 313 of file entity_component.py.
|
private |
Call when Home Assistant is stopping.
Definition at line 396 of file entity_component.py.
| list[_EntityT] homeassistant.helpers.entity_component.EntityComponent.async_extract_from_service | ( | self, | |
| ServiceCall | service_call, | ||
| bool | expand_group = True |
||
| ) |
Extract all known and available entities from a service call. Will return an empty list if entities specified but unknown. This method must be run in the event loop.
Definition at line 209 of file entity_component.py.
| ConfigType | None homeassistant.helpers.entity_component.EntityComponent.async_prepare_reload | ( | self, | |
| *bool | skip_reset = False |
||
| ) |
Prepare reloading this entity component. This method must be run in the event loop.
Definition at line 344 of file entity_component.py.
| None homeassistant.helpers.entity_component.EntityComponent.async_register_entity_service | ( | self, | |
| str | name, | ||
| VolDictType | VolSchemaType | None | schema, | ||
| str | Callable[..., Any] | func, | ||
| list[int] | None | required_features = None, |
||
| SupportsResponse | supports_response = SupportsResponse.NONE |
||
| ) |
Register an entity service.
Definition at line 260 of file entity_component.py.
| None homeassistant.helpers.entity_component.EntityComponent.async_register_legacy_entity_service | ( | self, | |
| str | name, | ||
| VolDictType | VolSchemaType | schema, | ||
| str | Callable[..., Any] | func, | ||
| list[int] | None | required_features = None, |
||
| SupportsResponse | supports_response = SupportsResponse.NONE |
||
| ) |
Register an entity service with a legacy response format.
Definition at line 223 of file entity_component.py.
| None homeassistant.helpers.entity_component.EntityComponent.async_remove_entity | ( | self, | |
| str | entity_id | ||
| ) |
Remove an entity managed by one of the platforms.
Definition at line 332 of file entity_component.py.
| None homeassistant.helpers.entity_component.EntityComponent.async_setup | ( | self, | |
| ConfigType | config | ||
| ) |
Set up a full entity component. Loads the platforms from the config and will listen for supported discovered platforms. This method must be run in the event loop.
Definition at line 135 of file entity_component.py.
| bool homeassistant.helpers.entity_component.EntityComponent.async_setup_entry | ( | self, | |
| ConfigEntry | config_entry | ||
| ) |
Set up a config entry.
Definition at line 168 of file entity_component.py.
| None homeassistant.helpers.entity_component.EntityComponent.async_setup_platform | ( | self, | |
| str | platform_type, | ||
| ConfigType | platform_config, | ||
| DiscoveryInfoType | None | discovery_info = None |
||
| ) |
Set up a platform for this component.
Definition at line 281 of file entity_component.py.
| bool homeassistant.helpers.entity_component.EntityComponent.async_unload_entry | ( | self, | |
| ConfigEntry | config_entry | ||
| ) |
Unload a config entry.
Definition at line 199 of file entity_component.py.
| Iterable[_EntityT] homeassistant.helpers.entity_component.EntityComponent.entities | ( | self | ) |
Return an iterable that returns all entities. As the underlying dicts may change when async context is lost, callers that iterate over this asynchronously should make a copy using list() before iterating.
Definition at line 105 of file entity_component.py.
| _EntityT | None homeassistant.helpers.entity_component.EntityComponent.get_entity | ( | self, | |
| str | entity_id | ||
| ) |
Get an entity.
Definition at line 114 of file entity_component.py.
| None homeassistant.helpers.entity_component.EntityComponent.register_shutdown | ( | self | ) |
Register shutdown on Home Assistant STOP event. Note: this is only required if the integration never calls `setup` or `async_setup`.
Definition at line 118 of file entity_component.py.
| None homeassistant.helpers.entity_component.EntityComponent.setup | ( | self, | |
| ConfigType | config | ||
| ) |
Set up a full entity component. This doesn't block the executor to protect from deadlocks.
Definition at line 126 of file entity_component.py.
|
private |
Definition at line 329 of file entity_component.py.
| homeassistant.helpers.entity_component.EntityComponent.add_entities |
Definition at line 100 of file entity_component.py.
| homeassistant.helpers.entity_component.EntityComponent.async_add_entities |
Definition at line 99 of file entity_component.py.
| homeassistant.helpers.entity_component.EntityComponent.config |
Definition at line 145 of file entity_component.py.
| homeassistant.helpers.entity_component.EntityComponent.domain |
Definition at line 90 of file entity_component.py.
| homeassistant.helpers.entity_component.EntityComponent.hass |
Definition at line 89 of file entity_component.py.
| homeassistant.helpers.entity_component.EntityComponent.logger |
Definition at line 88 of file entity_component.py.
| homeassistant.helpers.entity_component.EntityComponent.scan_interval |
Definition at line 91 of file entity_component.py.