Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.script.ScriptEntity Class Reference
Inheritance diagram for homeassistant.components.script.ScriptEntity:
[legend]
Collaboration diagram for homeassistant.components.script.ScriptEntity:
[legend]

Public Member Functions

None __init__ (self, HomeAssistant hass, str key, ConfigType cfg, ConfigType|None raw_config, ConfigType|None blueprint_inputs)
 
None async_added_to_hass (self)
 
None async_change_listener (self)
 
None async_turn_off (self, **Any kwargs)
 
None async_turn_on (self, **Any kwargs)
 
None async_will_remove_from_hass (self)
 
dict[str, Any] extra_state_attributes (self)
 
bool is_on (self)
 
set[strreferenced_areas (self)
 
str|None referenced_blueprint (self)
 
set[strreferenced_devices (self)
 
set[strreferenced_entities (self)
 
set[strreferenced_floors (self)
 
set[strreferenced_labels (self)
 
- Public Member Functions inherited from homeassistant.helpers.entity.ToggleEntity
None async_toggle (self, **Any kwargs)
 
Literal["on", "off"]|None state (self)
 
None toggle (self, **Any kwargs)
 
None turn_off (self, **Any kwargs)
 
None turn_on (self, **Any kwargs)
 
- 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_on_remove (self, CALLBACK_TYPE func)
 
None async_registry_entry_updated (self)
 
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_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)
 
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)
 
dict[str, Any]|None state_attributes (self)
 
str|None suggested_object_id (self)
 
int|None supported_features (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.helpers.restore_state.RestoreEntity
ExtraStoredData|None async_get_last_extra_data (self)
 
State|None async_get_last_state (self)
 
None async_internal_added_to_hass (self)
 
None async_internal_will_remove_from_hass (self)
 
ExtraStoredData|None extra_restore_state_data (self)
 

Public Attributes

 description
 
 entity_id
 
 fields
 
 raw_config
 
 script
 
- Public Attributes inherited from homeassistant.helpers.entity.Entity
 device_entry
 
 entity_id
 
 hass
 
 parallel_updates
 
 platform
 
 registry_entry
 

Static Public Attributes

 icon = None
 
- Static Public Attributes inherited from homeassistant.helpers.entity.ToggleEntity
 None
 
- Static Public Attributes inherited from homeassistant.helpers.entity.Entity
 bool
 
 EntityPlatform
 
 HomeAssistant
 
 None
 
 StateInfo
 
 StateType
 
 str
 

Private Member Functions

ScriptRunResult|None _async_run (self, dict[str, Any]|None variables, Context context)
 
ServiceResponse _async_start_run (self, dict[str, Any]|None variables, Context context, bool wait)
 
ServiceResponse _service_handler (self, ServiceCall service)
 

Private Attributes

 _attr_name
 
 _attr_unique_id
 
 _blueprint_inputs
 
 _changed
 
 _trace_config
 

Static Private Attributes

bool _attr_should_poll = False
 

Detailed Description

Representation of a script entity.

Definition at line 540 of file __init__.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.components.script.ScriptEntity.__init__ (   self,
HomeAssistant  hass,
str  key,
ConfigType  cfg,
ConfigType | None  raw_config,
ConfigType | None  blueprint_inputs 
)
Initialize the script.

Definition at line 547 of file __init__.py.

Member Function Documentation

◆ _async_run()

ScriptRunResult | None homeassistant.components.script.ScriptEntity._async_run (   self,
dict[str, Any] | None  variables,
Context   context 
)
private

Definition at line 689 of file __init__.py.

◆ _async_start_run()

ServiceResponse homeassistant.components.script.ScriptEntity._async_start_run (   self,
dict[str, Any] | None  variables,
Context  context,
bool   wait 
)
private
Start the run of a script.

Definition at line 653 of file __init__.py.

◆ _service_handler()

ServiceResponse homeassistant.components.script.ScriptEntity._service_handler (   self,
ServiceCall  service 
)
private
Execute a service call to script.<script name>.

Definition at line 716 of file __init__.py.

◆ async_added_to_hass()

None homeassistant.components.script.ScriptEntity.async_added_to_hass (   self)
Restore last triggered on startup and register service.

Reimplemented from homeassistant.helpers.entity.Entity.

Definition at line 725 of file __init__.py.

◆ async_change_listener()

None homeassistant.components.script.ScriptEntity.async_change_listener (   self)
Update state.

Definition at line 637 of file __init__.py.

◆ async_turn_off()

None homeassistant.components.script.ScriptEntity.async_turn_off (   self,
**Any  kwargs 
)
Stop running the script.

If multiple runs are in progress, all will be stopped.

Reimplemented from homeassistant.helpers.entity.ToggleEntity.

Definition at line 709 of file __init__.py.

◆ async_turn_on()

None homeassistant.components.script.ScriptEntity.async_turn_on (   self,
**Any  kwargs 
)
Run the script.

Depending on the script's run mode, this may do nothing, restart the script or
fire an additional parallel run.

Reimplemented from homeassistant.helpers.entity.ToggleEntity.

Definition at line 642 of file __init__.py.

◆ async_will_remove_from_hass()

None homeassistant.components.script.ScriptEntity.async_will_remove_from_hass (   self)
Stop script and remove service when it will be removed from HA.

Reimplemented from homeassistant.helpers.entity.Entity.

Definition at line 754 of file __init__.py.

◆ extra_state_attributes()

dict[str, Any] homeassistant.components.script.ScriptEntity.extra_state_attributes (   self)
Return the state attributes.

Reimplemented from homeassistant.helpers.entity.Entity.

Definition at line 584 of file __init__.py.

◆ is_on()

bool homeassistant.components.script.ScriptEntity.is_on (   self)
Return true if script is on.

Reimplemented from homeassistant.helpers.entity.ToggleEntity.

Definition at line 599 of file __init__.py.

◆ referenced_areas()

set[str] homeassistant.components.script.ScriptEntity.referenced_areas (   self)
Return a set of referenced areas.

Reimplemented from homeassistant.components.script.BaseScriptEntity.

Definition at line 614 of file __init__.py.

◆ referenced_blueprint()

str | None homeassistant.components.script.ScriptEntity.referenced_blueprint (   self)
Return referenced blueprint or None.

Reimplemented from homeassistant.components.script.BaseScriptEntity.

Definition at line 619 of file __init__.py.

◆ referenced_devices()

set[str] homeassistant.components.script.ScriptEntity.referenced_devices (   self)
Return a set of referenced devices.

Reimplemented from homeassistant.components.script.BaseScriptEntity.

Definition at line 627 of file __init__.py.

◆ referenced_entities()

set[str] homeassistant.components.script.ScriptEntity.referenced_entities (   self)
Return a set of referenced entities.

Reimplemented from homeassistant.components.script.BaseScriptEntity.

Definition at line 632 of file __init__.py.

◆ referenced_floors()

set[str] homeassistant.components.script.ScriptEntity.referenced_floors (   self)
Return a set of referenced floors.

Reimplemented from homeassistant.components.script.BaseScriptEntity.

Definition at line 609 of file __init__.py.

◆ referenced_labels()

set[str] homeassistant.components.script.ScriptEntity.referenced_labels (   self)
Return a set of referenced labels.

Reimplemented from homeassistant.components.script.BaseScriptEntity.

Definition at line 604 of file __init__.py.

Member Data Documentation

◆ _attr_name

homeassistant.components.script.ScriptEntity._attr_name
private

Definition at line 581 of file __init__.py.

◆ _attr_should_poll

bool homeassistant.components.script.ScriptEntity._attr_should_poll = False
staticprivate

Definition at line 544 of file __init__.py.

◆ _attr_unique_id

homeassistant.components.script.ScriptEntity._attr_unique_id
private

Definition at line 561 of file __init__.py.

◆ _blueprint_inputs

homeassistant.components.script.ScriptEntity._blueprint_inputs
private

Definition at line 580 of file __init__.py.

◆ _changed

homeassistant.components.script.ScriptEntity._changed
private

Definition at line 577 of file __init__.py.

◆ _trace_config

homeassistant.components.script.ScriptEntity._trace_config
private

Definition at line 579 of file __init__.py.

◆ description

homeassistant.components.script.ScriptEntity.description

Definition at line 557 of file __init__.py.

◆ entity_id

homeassistant.components.script.ScriptEntity.entity_id

Definition at line 563 of file __init__.py.

◆ fields

homeassistant.components.script.ScriptEntity.fields

Definition at line 558 of file __init__.py.

◆ icon

homeassistant.components.script.ScriptEntity.icon = None
static

Definition at line 543 of file __init__.py.

◆ raw_config

homeassistant.components.script.ScriptEntity.raw_config

Definition at line 578 of file __init__.py.

◆ script

homeassistant.components.script.ScriptEntity.script

Definition at line 564 of file __init__.py.


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