Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.template.lock.TemplateLock Class Reference
Inheritance diagram for homeassistant.components.template.lock.TemplateLock:
[legend]
Collaboration diagram for homeassistant.components.template.lock.TemplateLock:
[legend]

Public Member Functions

None __init__ (self, HomeAssistant hass, dict[str, Any] config, str|None unique_id)
 
None async_lock (self, **Any kwargs)
 
None async_open (self, **Any kwargs)
 
None async_unlock (self, **Any kwargs)
 
str|None code_format (self)
 
bool is_jammed (self)
 
bool is_locked (self)
 
bool is_locking (self)
 
bool is_open (self)
 
bool is_unlocking (self)
 
- Public Member Functions inherited from homeassistant.components.template.template_entity.TemplateEntity
None __init__ (self, HomeAssistant hass, *Template|None availability_template=None, Template|None icon_template=None, Template|None entity_picture_template=None, dict[str, Template]|None attribute_templates=None, ConfigType|None config=None, str|None fallback_name=None, str|None unique_id=None)
 
None add_template_attribute (self, str attribute, Template template, Callable[[Any], Any]|None validator=None, Callable[[Any], None]|None on_update=None, bool none_on_template_error=False)
 
None async_added_to_hass (self)
 
None async_run_script (self, Script script, *_VarsType|None run_variables=None, Context|None context=None)
 
CALLBACK_TYPE async_start_preview (self, Callable[[str|None, Mapping[str, Any]|None, dict[str, bool|set[str]]|None, str|None,], None,] preview_callback)
 
None async_update (self)
 
str|None referenced_blueprint (self)
 
- Public Member Functions inherited from homeassistant.helpers.entity.Entity
None __init_subclass__ (cls, **Any kwargs)
 
str __repr__ (self)
 
None add_to_platform_abort (self)
 
None add_to_platform_finish (self)
 
None add_to_platform_start (self, HomeAssistant hass, EntityPlatform platform, asyncio.Semaphore|None parallel_updates)
 
bool assumed_state (self)
 
None async_device_update (self, bool warning=True)
 
None async_internal_will_remove_from_hass (self)
 
None async_on_remove (self, CALLBACK_TYPE func)
 
None async_remove (self, *bool force_remove=False)
 
None async_removed_from_registry (self)
 
None async_schedule_update_ha_state (self, bool force_refresh=False)
 
None async_set_context (self, Context context)
 
None async_update_ha_state (self, bool force_refresh=False)
 
None async_will_remove_from_hass (self)
 
None async_write_ha_state (self)
 
str|None attribution (self)
 
bool available (self)
 
dict[str, Any]|None capability_attributes (self)
 
str|None device_class (self)
 
DeviceInfo|None device_info (self)
 
bool enabled (self)
 
EntityCategory|None entity_category (self)
 
str|None entity_picture (self)
 
bool entity_registry_enabled_default (self)
 
bool entity_registry_visible_default (self)
 
Mapping[str, Any]|None extra_state_attributes (self)
 
bool force_update (self)
 
HassJobType get_hassjob_type (self, str function_name)
 
er.EntityOptionsType|None get_initial_entity_options (self)
 
bool has_entity_name (self)
 
str|None icon (self)
 
str|UndefinedType|None name (self)
 
None schedule_update_ha_state (self, bool force_refresh=False)
 
bool should_poll (self)
 
str|None suggested_object_id (self)
 
str|None translation_key (self)
 
Mapping[str, strtranslation_placeholders (self)
 
str|None unique_id (self)
 
str|None unit_of_measurement (self)
 
bool use_device_name (self)
 
- Public Member Functions inherited from homeassistant.helpers.entity.CachedProperties
None __init__ (cls, str name, tuple[type,...] bases, dict[Any, Any] namespace, **Any kwargs)
 
Any __new__ (mcs, str name, tuple[type,...] bases, dict[Any, Any] namespace, set[str]|None cached_properties=None, **Any kwargs)
 
- Public Member Functions inherited from homeassistant.components.lock.LockEntity
dict[Any, Any] add_default_code (self, dict[Any, Any] data)
 
None async_handle_lock_service (self, **Any kwargs)
 
None async_handle_open_service (self, **Any kwargs)
 
None async_handle_unlock_service (self, **Any kwargs)
 
None async_internal_added_to_hass (self)
 
None async_registry_entry_updated (self)
 
str|None changed_by (self)
 
re.Pattern[str]|None code_format_cmp (self)
 
bool|None is_opening (self)
 
None lock (self, **Any kwargs)
 
None open (self, **Any kwargs)
 
str|None state (self)
 
dict[str, StateTypestate_attributes (self)
 
LockEntityFeature supported_features (self)
 
None unlock (self, **Any kwargs)
 

Private Member Functions

None _async_setup_templates (self)
 
def _raise_template_error_if_available (self)
 
def _update_code_format (self, str|TemplateError|None render)
 
def _update_state (self, result)
 

Private Attributes

 _attr_assumed_state
 
 _code_format
 
 _code_format_template
 
 _code_format_template_error
 
 _command_lock
 
 _command_open
 
 _command_unlock
 
 _optimistic
 
 _state
 
 _state_template
 

Static Private Attributes

bool _attr_should_poll = False
 

Additional Inherited Members

- Public Attributes inherited from homeassistant.components.template.template_entity.TemplateEntity
 entity_id
 
- Public Attributes inherited from homeassistant.helpers.entity.Entity
 device_entry
 
 entity_id
 
 hass
 
 parallel_updates
 
 platform
 
 registry_entry
 
- Static Public Attributes inherited from homeassistant.helpers.entity.Entity
 bool
 
 EntityPlatform
 
 HomeAssistant
 
 None
 
 StateInfo
 
 StateType
 
 str
 
- Static Public Attributes inherited from homeassistant.components.lock.LockEntity
 LockEntityFeature
 
 None
 
 str
 

Detailed Description

Representation of a template lock.

Definition at line 77 of file lock.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.components.template.lock.TemplateLock.__init__ (   self,
HomeAssistant  hass,
dict[str, Any]  config,
str | None  unique_id 
)
Initialize the lock.

Definition at line 82 of file lock.py.

Member Function Documentation

◆ _async_setup_templates()

None homeassistant.components.template.lock.TemplateLock._async_setup_templates (   self)
private
Set up templates.

Reimplemented from homeassistant.components.template.template_entity.TemplateEntity.

Definition at line 156 of file lock.py.

◆ _raise_template_error_if_available()

def homeassistant.components.template.lock.TemplateLock._raise_template_error_if_available (   self)
private
Raise an error if the rendered code format is not valid.

Definition at line 233 of file lock.py.

◆ _update_code_format()

def homeassistant.components.template.lock.TemplateLock._update_code_format (   self,
str | TemplateError | None  render 
)
private
Update code format from the template.

Definition at line 173 of file lock.py.

◆ _update_state()

def homeassistant.components.template.lock.TemplateLock._update_state (   self,
  result 
)
private
Update the state from the template.

Definition at line 133 of file lock.py.

◆ async_lock()

None homeassistant.components.template.lock.TemplateLock.async_lock (   self,
**Any  kwargs 
)
Lock the device.

Reimplemented from homeassistant.components.lock.LockEntity.

Definition at line 185 of file lock.py.

◆ async_open()

None homeassistant.components.template.lock.TemplateLock.async_open (   self,
**Any  kwargs 
)
Open the device.

Reimplemented from homeassistant.components.lock.LockEntity.

Definition at line 217 of file lock.py.

◆ async_unlock()

None homeassistant.components.template.lock.TemplateLock.async_unlock (   self,
**Any  kwargs 
)
Unlock the device.

Reimplemented from homeassistant.components.lock.LockEntity.

Definition at line 201 of file lock.py.

◆ code_format()

str | None homeassistant.components.template.lock.TemplateLock.code_format (   self)
Regex for code format or None if no code is required.

Reimplemented from homeassistant.components.lock.LockEntity.

Definition at line 151 of file lock.py.

◆ is_jammed()

bool homeassistant.components.template.lock.TemplateLock.is_jammed (   self)
Return true if lock is jammed.

Reimplemented from homeassistant.components.lock.LockEntity.

Definition at line 113 of file lock.py.

◆ is_locked()

bool homeassistant.components.template.lock.TemplateLock.is_locked (   self)
Return true if lock is locked.

Reimplemented from homeassistant.components.lock.LockEntity.

Definition at line 108 of file lock.py.

◆ is_locking()

bool homeassistant.components.template.lock.TemplateLock.is_locking (   self)
Return true if lock is locking.

Reimplemented from homeassistant.components.lock.LockEntity.

Definition at line 123 of file lock.py.

◆ is_open()

bool homeassistant.components.template.lock.TemplateLock.is_open (   self)
Return true if lock is open.

Reimplemented from homeassistant.components.lock.LockEntity.

Definition at line 128 of file lock.py.

◆ is_unlocking()

bool homeassistant.components.template.lock.TemplateLock.is_unlocking (   self)
Return true if lock is unlocking.

Reimplemented from homeassistant.components.lock.LockEntity.

Definition at line 118 of file lock.py.

Member Data Documentation

◆ _attr_assumed_state

homeassistant.components.template.lock.TemplateLock._attr_assumed_state
private

Definition at line 105 of file lock.py.

◆ _attr_should_poll

bool homeassistant.components.template.lock.TemplateLock._attr_should_poll = False
staticprivate

Definition at line 80 of file lock.py.

◆ _code_format

homeassistant.components.template.lock.TemplateLock._code_format
private

Definition at line 176 of file lock.py.

◆ _code_format_template

homeassistant.components.template.lock.TemplateLock._code_format_template
private

Definition at line 101 of file lock.py.

◆ _code_format_template_error

homeassistant.components.template.lock.TemplateLock._code_format_template_error
private

Definition at line 177 of file lock.py.

◆ _command_lock

homeassistant.components.template.lock.TemplateLock._command_lock
private

Definition at line 96 of file lock.py.

◆ _command_open

homeassistant.components.template.lock.TemplateLock._command_open
private

Definition at line 99 of file lock.py.

◆ _command_unlock

homeassistant.components.template.lock.TemplateLock._command_unlock
private

Definition at line 97 of file lock.py.

◆ _optimistic

homeassistant.components.template.lock.TemplateLock._optimistic
private

Definition at line 104 of file lock.py.

◆ _state

homeassistant.components.template.lock.TemplateLock._state
private

Definition at line 115 of file lock.py.

◆ _state_template

homeassistant.components.template.lock.TemplateLock._state_template
private

Definition at line 95 of file lock.py.


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