Public Attributes | |
| entity_id | |
Public Attributes inherited from homeassistant.helpers.entity.Entity | |
| device_entry | |
| entity_id | |
| hass | |
| parallel_updates | |
| platform | |
| registry_entry | |
Private Member Functions | |
| None | _add_attribute_template (self, str attribute_key, Template attribute_template) |
| None | _async_setup_templates (self) |
| None | _async_template_startup (self, HomeAssistant|None _hass, Callable[[int, str], None]|None log_fn=None) |
| None | _handle_results (self, Event[EventStateChangedData]|None event, list[TrackTemplateResult] updates) |
| dict | _render_variables (self) |
| None | _update_available (self, str|TemplateError result) |
| None | _update_state (self, str|TemplateError result) |
Static Private Attributes | |
| bool | _attr_available = True |
| _attr_entity_picture = None | |
| _attr_icon = None | |
Additional Inherited Members | |
Static Public Attributes inherited from homeassistant.helpers.entity.Entity | |
| bool | |
| EntityPlatform | |
| HomeAssistant | |
| None | |
| StateInfo | |
| StateType | |
| str | |
Entity that uses templates to calculate attributes.
Definition at line 251 of file template_entity.py.
| None homeassistant.components.template.template_entity.TemplateEntity.__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 |
||
| ) |
Template Entity.
Definition at line 258 of file template_entity.py.
|
private |
Create a template tracker for the attribute.
Definition at line 370 of file template_entity.py.
|
private |
Set up templates.
Reimplemented in homeassistant.components.template.weather.WeatherTemplate, homeassistant.components.template.vacuum.TemplateVacuum, homeassistant.components.template.switch.SwitchTemplate, homeassistant.components.template.sensor.SensorTemplate, homeassistant.components.template.select.TemplateSelect, homeassistant.components.template.number.TemplateNumber, homeassistant.components.template.lock.TemplateLock, homeassistant.components.template.light.LightTemplate, homeassistant.components.template.image.StateImageEntity, homeassistant.components.template.fan.TemplateFan, homeassistant.components.template.cover.CoverTemplate, homeassistant.components.template.binary_sensor.BinarySensorTemplate, and homeassistant.components.template.alarm_control_panel.AlarmControlPanelTemplate.
Definition at line 520 of file template_entity.py.
|
private |
Definition at line 481 of file template_entity.py.
|
private |
Call back the results to the attributes.
Definition at line 428 of file template_entity.py.
|
private |
Definition at line 343 of file template_entity.py.
|
private |
Definition at line 355 of file template_entity.py.
|
private |
Definition at line 363 of file template_entity.py.
| None homeassistant.components.template.template_entity.TemplateEntity.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 |
||
| ) |
Call in the constructor to add a template linked to a attribute.
Parameters
----------
attribute
The name of the attribute to link to. This attribute must exist
unless a custom on_update method is supplied.
template
The template to calculate.
validator
Validator function to parse the result and ensure it's valid.
on_update
Called to store the template result rather than storing it
the supplied attribute. Passed the result of the validator, or None
if the template or validator resulted in an error.
none_on_template_error
If True, the attribute will be set to None if the template errors.
Definition at line 390 of file template_entity.py.
| None homeassistant.components.template.template_entity.TemplateEntity.async_added_to_hass | ( | self | ) |
Run when entity about to be added to hass.
Reimplemented from homeassistant.helpers.entity.Entity.
Reimplemented in homeassistant.components.template.switch.SwitchTemplate, homeassistant.components.template.binary_sensor.BinarySensorTemplate, and homeassistant.components.template.alarm_control_panel.AlarmControlPanelTemplate.
Definition at line 574 of file template_entity.py.
| None homeassistant.components.template.template_entity.TemplateEntity.async_run_script | ( | self, | |
| Script | script, | ||
| *_VarsType | None | run_variables = None, |
||
| Context | None | context = None |
||
| ) |
Run an action script.
Definition at line 585 of file template_entity.py.
| CALLBACK_TYPE homeassistant.components.template.template_entity.TemplateEntity.async_start_preview | ( | self, | |
| Callable[ [ str | None, Mapping[str, Any] | None, dict[str, bool | set[str]] | None, str | None, ], None, ] | preview_callback | ||
| ) |
Render a preview.
Definition at line 549 of file template_entity.py.
| None homeassistant.components.template.template_entity.TemplateEntity.async_update | ( | self | ) |
Call for forced update.
Definition at line 580 of file template_entity.py.
| str | None homeassistant.components.template.template_entity.TemplateEntity.referenced_blueprint | ( | self | ) |
Return referenced blueprint or None.
Definition at line 384 of file template_entity.py.
|
staticprivate |
Definition at line 254 of file template_entity.py.
|
private |
Definition at line 357 of file template_entity.py.
|
staticprivate |
Definition at line 255 of file template_entity.py.
|
private |
Definition at line 273 of file template_entity.py.
|
staticprivate |
Definition at line 256 of file template_entity.py.
|
private |
Definition at line 321 of file template_entity.py.
|
private |
Definition at line 275 of file template_entity.py.
|
private |
Definition at line 289 of file template_entity.py.
|
private |
Definition at line 290 of file template_entity.py.
|
private |
Definition at line 295 of file template_entity.py.
|
private |
Definition at line 292 of file template_entity.py.
|
private |
Definition at line 293 of file template_entity.py.
|
private |
Definition at line 291 of file template_entity.py.
|
private |
Definition at line 566 of file template_entity.py.
|
private |
Definition at line 294 of file template_entity.py.
|
private |
Definition at line 274 of file template_entity.py.
|
private |
Definition at line 516 of file template_entity.py.
| homeassistant.components.template.template_entity.TemplateEntity.entity_id |
Definition at line 311 of file template_entity.py.