Home Assistant Unofficial Reference 2024.12.1
homeassistant.core_config.Config Class Reference

Classes

class  _ConfigStore
 

Public Member Functions

None __init__ (self, HomeAssistant hass, str config_dir)
 
dict[str, Any] as_dict (self)
 
None async_initialize (self)
 
None async_load (self)
 
None async_set_time_zone (self, str time_zone_str)
 
None async_update (self, **Any kwargs)
 
float|None distance (self, float lat, float lon)
 
bool is_allowed_external_url (self, str url)
 
bool is_allowed_path (self, str path)
 
str path (self, *str path)
 
None set_time_zone (self, str time_zone_str)
 

Public Attributes

 config_source
 
 country
 
 currency
 
 elevation
 
 external_url
 
 hass
 
 internal_url
 
 language
 
 latitude
 
 location_name
 
 longitude
 
 radius
 
 time_zone
 
 units
 
 webrtc
 

Private Member Functions

None _async_store (self)
 
None _async_update (self, *str|UndefinedType|None country=UNDEFINED, str|None currency=None, int|None elevation=None, str|UndefinedType|None external_url=UNDEFINED, str|UndefinedType|None internal_url=UNDEFINED, str|None language=None, float|None latitude=None, str|None location_name=None, float|None longitude=None, int|None radius=None, ConfigSource source, str|None time_zone=None, str|None unit_system=None)
 

Private Attributes

 _store
 

Detailed Description

Configuration settings for Home Assistant.

Definition at line 508 of file core_config.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.core_config.Config.__init__ (   self,
HomeAssistant  hass,
str  config_dir 
)
Initialize a new config object.

Definition at line 513 of file core_config.py.

Member Function Documentation

◆ _async_store()

None homeassistant.core_config.Config._async_store (   self)
private
Store [homeassistant] core config.

Definition at line 801 of file core_config.py.

◆ _async_update()

None homeassistant.core_config.Config._async_update (   self,
*str | UndefinedType | None   country = UNDEFINED,
str | None   currency = None,
int | None   elevation = None,
str | UndefinedType | None   external_url = UNDEFINED,
str | UndefinedType | None   internal_url = UNDEFINED,
str | None   language = None,
float | None   latitude = None,
str | None   location_name = None,
float | None   longitude = None,
int | None   radius = None,
ConfigSource  source,
str | None   time_zone = None,
str | None   unit_system = None 
)
private
Update the configuration from a dictionary.

Definition at line 710 of file core_config.py.

◆ as_dict()

dict[str, Any] homeassistant.core_config.Config.as_dict (   self)
Return a dictionary representation of the configuration.

Async friendly.

Definition at line 649 of file core_config.py.

◆ async_initialize()

None homeassistant.core_config.Config.async_initialize (   self)
Finish initializing a config object.

This must be called before the config object is used.

Definition at line 587 of file core_config.py.

◆ async_load()

None homeassistant.core_config.Config.async_load (   self)
Load [homeassistant] core config.

Definition at line 766 of file core_config.py.

◆ async_set_time_zone()

None homeassistant.core_config.Config.async_set_time_zone (   self,
str  time_zone_str 
)
Help to set the time zone.

Definition at line 682 of file core_config.py.

◆ async_update()

None homeassistant.core_config.Config.async_update (   self,
**Any  kwargs 
)
Update the configuration from a dictionary.

Definition at line 757 of file core_config.py.

◆ distance()

float | None homeassistant.core_config.Config.distance (   self,
float  lat,
float  lon 
)
Calculate distance from Home Assistant.

Async friendly.

Definition at line 594 of file core_config.py.

◆ is_allowed_external_url()

bool homeassistant.core_config.Config.is_allowed_external_url (   self,
str  url 
)
Check if an external URL is allowed.

Definition at line 611 of file core_config.py.

◆ is_allowed_path()

bool homeassistant.core_config.Config.is_allowed_path (   self,
str  path 
)
Check if the path is valid for access from outside.

This function does blocking I/O and should not be called from the event loop.
Use hass.async_add_executor_job to schedule it on the executor.

Definition at line 621 of file core_config.py.

◆ path()

str homeassistant.core_config.Config.path (   self,
*str  path 
)
Generate path to the file within the configuration directory.

Async friendly.

Definition at line 604 of file core_config.py.

◆ set_time_zone()

None homeassistant.core_config.Config.set_time_zone (   self,
str  time_zone_str 
)
Set the time zone.

This is a legacy method that should not be used in new code.
Use async_set_time_zone instead.

It will be removed in Home Assistant 2025.6.

Definition at line 690 of file core_config.py.

Member Data Documentation

◆ _store

homeassistant.core_config.Config._store
private

Definition at line 592 of file core_config.py.

◆ config_source

homeassistant.core_config.Config.config_source

Definition at line 728 of file core_config.py.

◆ country

homeassistant.core_config.Config.country

Definition at line 730 of file core_config.py.

◆ currency

homeassistant.core_config.Config.currency

Definition at line 732 of file core_config.py.

◆ elevation

homeassistant.core_config.Config.elevation

Definition at line 734 of file core_config.py.

◆ external_url

homeassistant.core_config.Config.external_url

Definition at line 736 of file core_config.py.

◆ hass

homeassistant.core_config.Config.hass

Definition at line 518 of file core_config.py.

◆ internal_url

homeassistant.core_config.Config.internal_url

Definition at line 738 of file core_config.py.

◆ language

homeassistant.core_config.Config.language

Definition at line 740 of file core_config.py.

◆ latitude

homeassistant.core_config.Config.latitude

Definition at line 742 of file core_config.py.

◆ location_name

homeassistant.core_config.Config.location_name

Definition at line 744 of file core_config.py.

◆ longitude

homeassistant.core_config.Config.longitude

Definition at line 746 of file core_config.py.

◆ radius

homeassistant.core_config.Config.radius

Definition at line 748 of file core_config.py.

◆ time_zone

homeassistant.core_config.Config.time_zone

Definition at line 685 of file core_config.py.

◆ units

homeassistant.core_config.Config.units

Definition at line 753 of file core_config.py.

◆ webrtc

homeassistant.core_config.Config.webrtc

Definition at line 585 of file core_config.py.


The documentation for this class was generated from the following file: