CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-homeassistant

tessl install tessl/pypi-homeassistant@2025.9.0

Open-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%

task.mdevals/scenario-7/

Smart Home Status Reporter

Build a utility that uses templates to generate dynamic status reports about smart home entities.

Capabilities

Template Creation and Basic Rendering

  • It creates a Template object and renders a simple static string @test
  • It renders a template with basic variable substitution using the render method @test
  • It renders a template that includes mathematical operations on variables @test

Template Rendering with Variables

  • It renders a template that uses multiple variables passed to the render method @test
  • It renders a template with conditional logic based on variable values @test

Template Validation

  • It validates that a template with correct syntax is marked as valid @test
  • It detects templates with invalid Jinja2 syntax during validation @test

Advanced Template Operations

  • It renders templates asynchronously using async_render @test
  • It renders complex nested data structures containing template strings @test
  • It checks if a template is static (contains no dynamic content) @test

Implementation

@generates

API

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

Dependencies { .dependencies }

homeassistant { .dependency }

Provides the template system with Jinja2 integration and Home Assistant-specific template functions.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/homeassistant@2025.9.x
tile.json