tessl install tessl/pypi-homeassistant@2025.9.0Open-source home automation platform running on Python 3.
Agent Success
Agent success rate when using this tile
69%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.19x
Baseline
Agent success rate without this tile
58%
Build a utility that uses templates to generate dynamic status reports about smart home entities.
@generates
from homeassistant.helpers.template import Template
from homeassistant.core import HomeAssistant
from typing import Any, Dict
def create_simple_template(template_string: str, hass: HomeAssistant) -> Template:
"""Create a Template object from a template string.
Args:
template_string: The Jinja2 template string
hass: Home Assistant instance
Returns:
Template object ready for rendering
"""
def render_template(template: Template, variables: Dict[str, Any] = None) -> str:
"""Render a template with optional variables.
Args:
template: Template object to render
variables: Dictionary of variables to pass to template
Returns:
Rendered template string
"""
async def render_template_async(template: Template, variables: Dict[str, Any] = None) -> str:
"""Render a template asynchronously.
Args:
template: Template object to render
variables: Dictionary of variables to pass to template
Returns:
Rendered template string
"""
def validate_template(template: Template) -> bool:
"""Validate that a template has correct syntax.
Args:
template: Template object to validate
Returns:
True if template is valid, False otherwise
"""
def render_complex_template(value: Any, variables: Dict[str, Any] = None) -> Any:
"""Render complex data structures that may contain template strings.
Args:
value: Value to render (may be dict, list, or contain templates)
variables: Template variables for rendering
Returns:
Rendered value with all templates evaluated
"""
def is_template_static(template: Template) -> bool:
"""Check if a template is static (contains no dynamic content).
Args:
template: Template object to check
Returns:
True if template is static, False if it contains dynamic expressions
"""Provides the template system with Jinja2 integration and Home Assistant-specific template functions.