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 simple device state tracking module for a smart home environment that manages entity states.
Your module should track smart home entities (lights, sensors, switches) and their states. The system must:
Each entity state includes:
@generates
from homeassistant.core import HomeAssistant
from typing import Optional, Dict, Any, List
async def setup_tracker(hass: HomeAssistant) -> None:
"""Initialize the state tracker with the Home Assistant instance."""
pass
async def set_device_state(
hass: HomeAssistant,
entity_id: str,
state: str,
attributes: Optional[Dict[str, Any]] = None
) -> None:
"""
Set or update a device state.
Args:
hass: The Home Assistant instance
entity_id: The unique identifier for the device (e.g., "light.bedroom")
state: The state value (e.g., "on", "off", "23.5")
attributes: Optional dictionary of device attributes
"""
pass
def get_device_state(hass: HomeAssistant, entity_id: str) -> Optional[Any]:
"""
Retrieve the current state of a device.
Args:
hass: The Home Assistant instance
entity_id: The unique identifier for the device
Returns:
The State object if found, None otherwise
"""
pass
async def remove_device_state(hass: HomeAssistant, entity_id: str) -> bool:
"""
Remove a device from state tracking.
Args:
hass: The Home Assistant instance
entity_id: The unique identifier for the device
Returns:
True if the device was removed, False if it didn't exist
"""
pass
async def get_all_device_states(hass: HomeAssistant) -> List[Any]:
"""
Retrieve all currently tracked device states.
Args:
hass: The Home Assistant instance
Returns:
A list of all State objects
"""
passProvides the core Home Assistant framework for state management and home automation.
@satisfied-by