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 label management system for organizing smart home entities. The system should allow users to create labels, assign them to entities, and query entities by their labels.
Create a LabelManager class that manages labels. Each label has:
The manager should support:
Implement functionality to:
Implement a method to find entities based on label criteria:
@generates
class LabelManager:
"""Manages labels for smart home entities."""
def create_label(self, name: str, color: str | None = None, icon: str | None = None) -> dict:
"""
Create a new label.
Args:
name: The label name (required)
color: Optional color in hex format (e.g., "#FF0000")
icon: Optional icon identifier
Returns:
Dictionary with label data including generated 'id', 'name', 'color', 'icon'
Raises:
ValueError: If name is not provided or is empty
"""
pass
def get_label(self, label_id: str) -> dict | None:
"""
Retrieve a label by its ID.
Args:
label_id: The label identifier
Returns:
Label dictionary or None if not found
"""
pass
def list_labels(self) -> list[dict]:
"""
Get all labels.
Returns:
List of all label dictionaries
"""
pass
def remove_label(self, label_id: str) -> bool:
"""
Remove a label.
Args:
label_id: The label identifier
Returns:
True if removed, False if not found
"""
pass
def assign_labels_to_entity(self, entity_id: str, label_ids: list[str]) -> None:
"""
Assign labels to an entity.
Args:
entity_id: The entity identifier
label_ids: List of label IDs to assign
"""
pass
def remove_labels_from_entity(self, entity_id: str, label_ids: list[str]) -> None:
"""
Remove labels from an entity.
Args:
entity_id: The entity identifier
label_ids: List of label IDs to remove
"""
pass
def get_entity_labels(self, entity_id: str) -> list[dict]:
"""
Get all labels assigned to an entity.
Args:
entity_id: The entity identifier
Returns:
List of label dictionaries assigned to the entity
"""
pass
def get_entities_with_label(self, label_id: str) -> list[str]:
"""
Get all entities that have a specific label.
Args:
label_id: The label identifier
Returns:
List of entity IDs
"""
pass
def find_entities_by_labels(self, label_ids: list[str], match_all: bool = True) -> list[str]:
"""
Find entities based on label criteria.
Args:
label_ids: List of label IDs to search for
match_all: If True, entities must have ALL labels; if False, entities must have ANY label
Returns:
List of entity IDs matching the criteria
"""
passProvides home automation platform capabilities including label registry functionality for organizing entities with custom tags.
@satisfied-by