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

Public Member Functions

def __init__ (self, hass, object_id, config, unique_id)
 
None async_turn_off (self, **Any kwargs)
 
None async_turn_on (self, **Any kwargs)
 
int|None brightness (self)
 
def color_mode (self)
 
int|None color_temp (self)
 
str|None effect (self)
 
list[str]|None effect_list (self)
 
tuple[float, float]|None hs_color (self)
 
bool|None is_on (self)
 
int max_mireds (self)
 
int min_mireds (self)
 
tuple[int, int, int]|None rgb_color (self)
 
tuple[int, int, int, int]|None rgbw_color (self)
 
tuple[int, int, int, int, int]|None rgbww_color (self)
 
def supported_color_modes (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_added_to_hass (self)
 
None async_internal_will_remove_from_hass (self)
 
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_will_remove_from_hass (self)
 
None async_write_ha_state (self)
 
str|None attribution (self)
 
bool available (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.light.LightEntity
dict[str, Any] capability_attributes (self)
 
int|None color_temp_kelvin (self)
 
int max_color_temp_kelvin (self)
 
int min_color_temp_kelvin (self)
 
dict[str, Any]|None state_attributes (self)
 
LightEntityFeature supported_features (self)
 
LightEntityFeature supported_features_compat (self)
 
tuple[float, float]|None xy_color (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 Attributes

 entity_id
 
- 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
 

Private Member Functions

None _async_setup_templates (self)
 
def _update_brightness (self, brightness)
 
def _update_effect (self, effect)
 
def _update_effect_list (self, effect_list)
 
def _update_hs (self, render)
 
def _update_max_mireds (self, render)
 
def _update_min_mireds (self, render)
 
def _update_rgb (self, render)
 
def _update_rgbw (self, render)
 
def _update_rgbww (self, render)
 
def _update_state (self, result)
 
def _update_supports_transition (self, render)
 
def _update_temperature (self, render)
 

Private Attributes

 _attr_available
 
 _attr_supported_features
 
 _brightness
 
 _color_mode
 
 _color_script
 
 _color_template
 
 _effect
 
 _effect_list
 
 _effect_list_template
 
 _effect_script
 
 _effect_template
 
 _hs_color
 
 _hs_script
 
 _hs_template
 
 _level_script
 
 _level_template
 
 _max_mireds
 
 _max_mireds_template
 
 _min_mireds
 
 _min_mireds_template
 
 _off_script
 
 _on_script
 
 _rgb_color
 
 _rgb_script
 
 _rgb_template
 
 _rgbw_color
 
 _rgbw_script
 
 _rgbw_template
 
 _rgbww_color
 
 _rgbww_script
 
 _rgbww_template
 
 _state
 
 _supported_color_modes
 
 _supports_transition
 
 _supports_transition_template
 
 _temperature
 
 _temperature_script
 
 _temperature_template
 
 _template
 

Static Private Attributes

bool _attr_should_poll = False
 

Additional Inherited Members

- Static Public Attributes inherited from homeassistant.helpers.entity.Entity
 bool
 
 EntityPlatform
 
 HomeAssistant
 
 None
 
 StateInfo
 
 StateType
 
 str
 
- Static Public Attributes inherited from homeassistant.components.light.LightEntity
 int
 
 LightEntityFeature
 
 None
 
- Static Public Attributes inherited from homeassistant.helpers.entity.ToggleEntity
 None
 

Detailed Description

Representation of a templated Light, including dimmable.

Definition at line 154 of file light.py.

Constructor & Destructor Documentation

◆ __init__()

def homeassistant.components.template.light.LightTemplate.__init__ (   self,
  hass,
  object_id,
  config,
  unique_id 
)
Initialize the light.

Definition at line 159 of file light.py.

Member Function Documentation

◆ _async_setup_templates()

None homeassistant.components.template.light.LightTemplate._async_setup_templates (   self)
private
Set up templates.

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

Definition at line 331 of file light.py.

◆ _update_brightness()

def homeassistant.components.template.light.LightTemplate._update_brightness (   self,
  brightness 
)
private
Update the brightness from the template.

Definition at line 659 of file light.py.

◆ _update_effect()

def homeassistant.components.template.light.LightTemplate._update_effect (   self,
  effect 
)
private
Update the effect from the template.

Definition at line 706 of file light.py.

◆ _update_effect_list()

def homeassistant.components.template.light.LightTemplate._update_effect_list (   self,
  effect_list 
)
private
Update the effect list from the template.

Definition at line 681 of file light.py.

◆ _update_hs()

def homeassistant.components.template.light.LightTemplate._update_hs (   self,
  render 
)
private
Update the color from the template.

Definition at line 782 of file light.py.

◆ _update_max_mireds()

def homeassistant.components.template.light.LightTemplate._update_max_mireds (   self,
  render 
)
private
Update the max mireds from the template.

Definition at line 965 of file light.py.

◆ _update_min_mireds()

def homeassistant.components.template.light.LightTemplate._update_min_mireds (   self,
  render 
)
private
Update the min mireds from the template.

Definition at line 981 of file light.py.

◆ _update_rgb()

def homeassistant.components.template.light.LightTemplate._update_rgb (   self,
  render 
)
private
Update the color from the template.

Definition at line 827 of file light.py.

◆ _update_rgbw()

def homeassistant.components.template.light.LightTemplate._update_rgbw (   self,
  render 
)
private
Update the color from the template.

Definition at line 872 of file light.py.

◆ _update_rgbww()

def homeassistant.components.template.light.LightTemplate._update_rgbww (   self,
  render 
)
private
Update the color from the template.

Definition at line 918 of file light.py.

◆ _update_state()

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

Definition at line 725 of file light.py.

◆ _update_supports_transition()

def homeassistant.components.template.light.LightTemplate._update_supports_transition (   self,
  render 
)
private
Update the supports transition from the template.

Definition at line 996 of file light.py.

◆ _update_temperature()

def homeassistant.components.template.light.LightTemplate._update_temperature (   self,
  render 
)
private
Update the temperature from the template.

Definition at line 752 of file light.py.

◆ async_turn_off()

None homeassistant.components.template.light.LightTemplate.async_turn_off (   self,
**Any  kwargs 
)
Turn the light off.

Reimplemented from homeassistant.helpers.entity.ToggleEntity.

Definition at line 644 of file light.py.

◆ async_turn_on()

None homeassistant.components.template.light.LightTemplate.async_turn_on (   self,
**Any  kwargs 
)
Turn the light on.

Reimplemented from homeassistant.helpers.entity.ToggleEntity.

Definition at line 435 of file light.py.

◆ brightness()

int | None homeassistant.components.template.light.LightTemplate.brightness (   self)
Return the brightness of the light.

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 260 of file light.py.

◆ color_mode()

def homeassistant.components.template.light.LightTemplate.color_mode (   self)
Return current color mode.

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 316 of file light.py.

◆ color_temp()

int | None homeassistant.components.template.light.LightTemplate.color_temp (   self)
Return the CT color value in mireds.

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 265 of file light.py.

◆ effect()

str | None homeassistant.components.template.light.LightTemplate.effect (   self)
Return the effect.

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 306 of file light.py.

◆ effect_list()

list[str] | None homeassistant.components.template.light.LightTemplate.effect_list (   self)
Return the effect list.

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 311 of file light.py.

◆ hs_color()

tuple[float, float] | None homeassistant.components.template.light.LightTemplate.hs_color (   self)
Return the hue and saturation color value [float, float].

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 286 of file light.py.

◆ is_on()

bool | None homeassistant.components.template.light.LightTemplate.is_on (   self)
Return true if device is on.

Reimplemented from homeassistant.helpers.entity.ToggleEntity.

Definition at line 326 of file light.py.

◆ max_mireds()

int homeassistant.components.template.light.LightTemplate.max_mireds (   self)
Return the max mireds value in mireds.

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 270 of file light.py.

◆ min_mireds()

int homeassistant.components.template.light.LightTemplate.min_mireds (   self)
Return the min mireds value in mireds.

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 278 of file light.py.

◆ rgb_color()

tuple[int, int, int] | None homeassistant.components.template.light.LightTemplate.rgb_color (   self)
Return the rgb color value.

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 291 of file light.py.

◆ rgbw_color()

tuple[int, int, int, int] | None homeassistant.components.template.light.LightTemplate.rgbw_color (   self)
Return the rgbw color value.

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 296 of file light.py.

◆ rgbww_color()

tuple[int, int, int, int, int] | None homeassistant.components.template.light.LightTemplate.rgbww_color (   self)
Return the rgbww color value.

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 301 of file light.py.

◆ supported_color_modes()

def homeassistant.components.template.light.LightTemplate.supported_color_modes (   self)
Flag supported color modes.

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 321 of file light.py.

Member Data Documentation

◆ _attr_available

homeassistant.components.template.light.LightTemplate._attr_available
private

Definition at line 731 of file light.py.

◆ _attr_should_poll

bool homeassistant.components.template.light.LightTemplate._attr_should_poll = False
staticprivate

Definition at line 157 of file light.py.

◆ _attr_supported_features

homeassistant.components.template.light.LightTemplate._attr_supported_features
private

Definition at line 253 of file light.py.

◆ _brightness

homeassistant.components.template.light.LightTemplate._brightness
private

Definition at line 217 of file light.py.

◆ _color_mode

homeassistant.components.template.light.LightTemplate._color_mode
private

Definition at line 225 of file light.py.

◆ _color_script

homeassistant.components.template.light.LightTemplate._color_script
private

Definition at line 187 of file light.py.

◆ _color_template

homeassistant.components.template.light.LightTemplate._color_template
private

Definition at line 190 of file light.py.

◆ _effect

homeassistant.components.template.light.LightTemplate._effect
private

Definition at line 223 of file light.py.

◆ _effect_list

homeassistant.components.template.light.LightTemplate._effect_list
private

Definition at line 224 of file light.py.

◆ _effect_list_template

homeassistant.components.template.light.LightTemplate._effect_list_template
private

Definition at line 210 of file light.py.

◆ _effect_script

homeassistant.components.template.light.LightTemplate._effect_script
private

Definition at line 207 of file light.py.

◆ _effect_template

homeassistant.components.template.light.LightTemplate._effect_template
private

Definition at line 211 of file light.py.

◆ _hs_color

homeassistant.components.template.light.LightTemplate._hs_color
private

Definition at line 219 of file light.py.

◆ _hs_script

homeassistant.components.template.light.LightTemplate._hs_script
private

Definition at line 191 of file light.py.

◆ _hs_template

homeassistant.components.template.light.LightTemplate._hs_template
private

Definition at line 194 of file light.py.

◆ _level_script

homeassistant.components.template.light.LightTemplate._level_script
private

Definition at line 177 of file light.py.

◆ _level_template

homeassistant.components.template.light.LightTemplate._level_template
private

Definition at line 180 of file light.py.

◆ _max_mireds

homeassistant.components.template.light.LightTemplate._max_mireds
private

Definition at line 226 of file light.py.

◆ _max_mireds_template

homeassistant.components.template.light.LightTemplate._max_mireds_template
private

Definition at line 212 of file light.py.

◆ _min_mireds

homeassistant.components.template.light.LightTemplate._min_mireds
private

Definition at line 227 of file light.py.

◆ _min_mireds_template

homeassistant.components.template.light.LightTemplate._min_mireds_template
private

Definition at line 213 of file light.py.

◆ _off_script

homeassistant.components.template.light.LightTemplate._off_script
private

Definition at line 176 of file light.py.

◆ _on_script

homeassistant.components.template.light.LightTemplate._on_script
private

Definition at line 175 of file light.py.

◆ _rgb_color

homeassistant.components.template.light.LightTemplate._rgb_color
private

Definition at line 220 of file light.py.

◆ _rgb_script

homeassistant.components.template.light.LightTemplate._rgb_script
private

Definition at line 195 of file light.py.

◆ _rgb_template

homeassistant.components.template.light.LightTemplate._rgb_template
private

Definition at line 198 of file light.py.

◆ _rgbw_color

homeassistant.components.template.light.LightTemplate._rgbw_color
private

Definition at line 221 of file light.py.

◆ _rgbw_script

homeassistant.components.template.light.LightTemplate._rgbw_script
private

Definition at line 199 of file light.py.

◆ _rgbw_template

homeassistant.components.template.light.LightTemplate._rgbw_template
private

Definition at line 202 of file light.py.

◆ _rgbww_color

homeassistant.components.template.light.LightTemplate._rgbww_color
private

Definition at line 222 of file light.py.

◆ _rgbww_script

homeassistant.components.template.light.LightTemplate._rgbww_script
private

Definition at line 203 of file light.py.

◆ _rgbww_template

homeassistant.components.template.light.LightTemplate._rgbww_template
private

Definition at line 206 of file light.py.

◆ _state

homeassistant.components.template.light.LightTemplate._state
private

Definition at line 216 of file light.py.

◆ _supported_color_modes

homeassistant.components.template.light.LightTemplate._supported_color_modes
private

Definition at line 229 of file light.py.

◆ _supports_transition

homeassistant.components.template.light.LightTemplate._supports_transition
private

Definition at line 228 of file light.py.

◆ _supports_transition_template

homeassistant.components.template.light.LightTemplate._supports_transition_template
private

Definition at line 214 of file light.py.

◆ _temperature

homeassistant.components.template.light.LightTemplate._temperature
private

Definition at line 218 of file light.py.

◆ _temperature_script

homeassistant.components.template.light.LightTemplate._temperature_script
private

Definition at line 181 of file light.py.

◆ _temperature_template

homeassistant.components.template.light.LightTemplate._temperature_template
private

Definition at line 186 of file light.py.

◆ _template

homeassistant.components.template.light.LightTemplate._template
private

Definition at line 174 of file light.py.

◆ entity_id

homeassistant.components.template.light.LightTemplate.entity_id

Definition at line 170 of file light.py.


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