Home Assistant Unofficial Reference 2024.12.1
homeassistant.core Namespace Reference

Classes

class  _Hass
 
class  _OneTimeListener
 
class  CompressedState
 
class  ConfigSource
 
class  Context
 
class  CoreState
 
class  Event
 
class  EventBus
 
class  EventOrigin
 
class  EventStateChangedData
 
class  EventStateEventData
 
class  EventStateReportedData
 
class  HassJob
 
class  HassJobType
 
class  HassJobWithArgs
 
class  HomeAssistant
 
class  ReleaseChannel
 
class  Service
 
class  ServiceCall
 
class  ServiceRegistry
 
class  State
 
class  StateMachine
 
class  States
 
class  SupportsResponse
 

Functions

def _CallableT
 
Any _deprecated_core_config ()
 
str _event_repr (EventType[_DataT]|str event_type, EventOrigin origin, _DataT|None data)
 
None _verify_event_type_length_or_raise (EventType[_DataT]|str event_type)
 
HomeAssistant async_get_hass ()
 
HomeAssistant|None async_get_hass_or_none ()
 
HassJobType get_hassjob_callable_job_type (Callable[..., Any] target)
 
ReleaseChannel get_release_channel ()
 
bool is_callback (Callable[..., Any] func)
 
bool is_callback_check_partial (Callable[..., Any] target)
 
tuple[str, str] split_entity_id (str entity_id)
 
bool valid_domain (str domain)
 
bool valid_entity_id (str entity_id)
 
str validate_state (str state)
 

Variables

 __all__
 
 __dir__
 
 __getattr__
 
 _DataT = TypeVar("_DataT", bound=Mapping[str, Any], default=Mapping[str, Any])
 
 _DEPRECATED_Config
 
 _DEPRECATED_SOURCE_DISCOVERED
 
 _DEPRECATED_SOURCE_STORAGE
 
 _DEPRECATED_SOURCE_YAML
 
 _DOMAIN
 
 _FilterableJobType
 
 _hass
 
 _LOGGER
 
 _OBJECT_ID
 
 _SENTINEL = object()
 
int BLOCK_LOG_TIMEOUT = 60
 
 CALLBACK_TYPE
 
 check_if_deprecated_constant
 
int CLOSE_STAGE_SHUTDOWN_TIMEOUT = 30
 
 DEFAULT
 
 dir_with_deprecated_constants
 
 DISCOVERED
 
string DOMAIN = "homeassistant"
 
 EntityServiceResponse
 
 EVENTS_EXCLUDED_FROM_MATCH_ALL
 
int FINAL_WRITE_STAGE_SHUTDOWN_TIMEOUT = 60
 
 module_globals
 
 module_globals_keys
 
 ServiceResponse
 
int STOP_STAGE_SHUTDOWN_TIMEOUT = 100
 
int STOPPING_STAGE_SHUTDOWN_TIMEOUT = 20
 
 STORAGE
 
 TIMEOUT_EVENT_START
 
 VALID_DOMAIN
 
 VALID_ENTITY_ID
 
 YAML
 

Detailed Description

Core components of Home Assistant.

Home Assistant is a Home Automation framework for observing the state
of entities and react to changes.

Function Documentation

◆ _CallableT()

def homeassistant.core._CallableT
private

Definition at line 253 of file core.py.

◆ _deprecated_core_config()

Any homeassistant.core._deprecated_core_config ( )
private

Definition at line 188 of file core.py.

◆ _event_repr()

str homeassistant.core._event_repr ( EventType[_DataT] | str  event_type,
EventOrigin  origin,
_DataT | None   data 
)
private
Return the representation.

Definition at line 1418 of file core.py.

◆ _verify_event_type_length_or_raise()

None homeassistant.core._verify_event_type_length_or_raise ( EventType[_DataT] | str  event_type)
private
Verify the length of the event type and raise if too long.

Definition at line 1463 of file core.py.

◆ async_get_hass()

HomeAssistant homeassistant.core.async_get_hass ( )
Return the HomeAssistant instance.

Raises HomeAssistantError when called from the wrong thread.

This should be used where it's very cumbersome or downright impossible to pass
hass to the code which needs it.

Definition at line 286 of file core.py.

◆ async_get_hass_or_none()

HomeAssistant | None homeassistant.core.async_get_hass_or_none ( )
Return the HomeAssistant instance or None.

Returns None when called from the wrong thread.

Definition at line 299 of file core.py.

◆ get_hassjob_callable_job_type()

HassJobType homeassistant.core.get_hassjob_callable_job_type ( Callable[..., Any]  target)
Determine the job type from the callable.

Definition at line 387 of file core.py.

◆ get_release_channel()

ReleaseChannel homeassistant.core.get_release_channel ( )
Find release channel based on version number.

Definition at line 315 of file core.py.

◆ is_callback()

bool homeassistant.core.is_callback ( Callable[..., Any]  func)
Check if function is safe to be called in the event loop.

Definition at line 259 of file core.py.

◆ is_callback_check_partial()

bool homeassistant.core.is_callback_check_partial ( Callable[..., Any]  target)
Check if function is safe to be called in the event loop.

This version of is_callback will also check if the target is a partial
and walk the chain of partials to find the original function.

Definition at line 264 of file core.py.

◆ split_entity_id()

tuple[str, str] homeassistant.core.split_entity_id ( str  entity_id)
Split a state entity ID into domain and object ID.

Definition at line 214 of file core.py.

◆ valid_domain()

bool homeassistant.core.valid_domain ( str  domain)
Test if a domain a valid format.

Definition at line 229 of file core.py.

◆ valid_entity_id()

bool homeassistant.core.valid_entity_id ( str  entity_id)
Test if an entity ID is a valid format.

Format: <domain>.<entity> where both are slugs.

Definition at line 235 of file core.py.

◆ validate_state()

str homeassistant.core.validate_state ( str  state)
Validate a state, raise if it not valid.

Definition at line 243 of file core.py.

Variable Documentation

◆ __all__

homeassistant.core.__all__
private

Definition at line 2860 of file core.py.

◆ __dir__

homeassistant.core.__dir__
private

Definition at line 2857 of file core.py.

◆ __getattr__

homeassistant.core.__getattr__
private

Definition at line 2856 of file core.py.

◆ _DataT

homeassistant.core._DataT = TypeVar("_DataT", bound=Mapping[str, Any], default=Mapping[str, Any])
private

Definition at line 125 of file core.py.

◆ _DEPRECATED_Config

homeassistant.core._DEPRECATED_Config
private

Definition at line 196 of file core.py.

◆ _DEPRECATED_SOURCE_DISCOVERED

homeassistant.core._DEPRECATED_SOURCE_DISCOVERED
private

Definition at line 181 of file core.py.

◆ _DEPRECATED_SOURCE_STORAGE

homeassistant.core._DEPRECATED_SOURCE_STORAGE
private

Definition at line 184 of file core.py.

◆ _DEPRECATED_SOURCE_YAML

homeassistant.core._DEPRECATED_SOURCE_YAML
private

Definition at line 185 of file core.py.

◆ _DOMAIN

homeassistant.core._DOMAIN
private

Definition at line 223 of file core.py.

◆ _FilterableJobType

homeassistant.core._FilterableJobType
private

Definition at line 1428 of file core.py.

◆ _hass

homeassistant.core._hass
private

Definition at line 282 of file core.py.

◆ _LOGGER

homeassistant.core._LOGGER
private

Definition at line 210 of file core.py.

◆ _OBJECT_ID

homeassistant.core._OBJECT_ID
private

Definition at line 222 of file core.py.

◆ _SENTINEL

homeassistant.core._SENTINEL = object()
private

Definition at line 124 of file core.py.

◆ BLOCK_LOG_TIMEOUT

int homeassistant.core.BLOCK_LOG_TIMEOUT = 60

Definition at line 131 of file core.py.

◆ CALLBACK_TYPE

homeassistant.core.CALLBACK_TYPE

Definition at line 126 of file core.py.

◆ check_if_deprecated_constant

homeassistant.core.check_if_deprecated_constant

Definition at line 2856 of file core.py.

◆ CLOSE_STAGE_SHUTDOWN_TIMEOUT

int homeassistant.core.CLOSE_STAGE_SHUTDOWN_TIMEOUT = 30

Definition at line 121 of file core.py.

◆ DEFAULT

homeassistant.core.DEFAULT
Source of core configuration.

Definition at line 149 of file core.py.

◆ dir_with_deprecated_constants

homeassistant.core.dir_with_deprecated_constants

Definition at line 2858 of file core.py.

◆ DISCOVERED

homeassistant.core.DISCOVERED

Definition at line 150 of file core.py.

◆ DOMAIN

string homeassistant.core.DOMAIN = "homeassistant"

Definition at line 128 of file core.py.

◆ EntityServiceResponse

homeassistant.core.EntityServiceResponse

Definition at line 134 of file core.py.

◆ EVENTS_EXCLUDED_FROM_MATCH_ALL

homeassistant.core.EVENTS_EXCLUDED_FROM_MATCH_ALL

Definition at line 205 of file core.py.

◆ FINAL_WRITE_STAGE_SHUTDOWN_TIMEOUT

int homeassistant.core.FINAL_WRITE_STAGE_SHUTDOWN_TIMEOUT = 60

Definition at line 120 of file core.py.

◆ module_globals

homeassistant.core.module_globals

Definition at line 2856 of file core.py.

◆ module_globals_keys

homeassistant.core.module_globals_keys

Definition at line 2858 of file core.py.

◆ ServiceResponse

homeassistant.core.ServiceResponse

Definition at line 133 of file core.py.

◆ STOP_STAGE_SHUTDOWN_TIMEOUT

int homeassistant.core.STOP_STAGE_SHUTDOWN_TIMEOUT = 100

Definition at line 119 of file core.py.

◆ STOPPING_STAGE_SHUTDOWN_TIMEOUT

int homeassistant.core.STOPPING_STAGE_SHUTDOWN_TIMEOUT = 20

Definition at line 118 of file core.py.

◆ STORAGE

homeassistant.core.STORAGE

Definition at line 151 of file core.py.

◆ TIMEOUT_EVENT_START

homeassistant.core.TIMEOUT_EVENT_START

Definition at line 202 of file core.py.

◆ VALID_DOMAIN

homeassistant.core.VALID_DOMAIN

Definition at line 224 of file core.py.

◆ VALID_ENTITY_ID

homeassistant.core.VALID_ENTITY_ID

Definition at line 225 of file core.py.

◆ YAML

homeassistant.core.YAML

Definition at line 152 of file core.py.