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 control system that registers and manages services for controlling smart home devices.
Create a Python module that implements a service manager for a smart home device controller. The system should:
notify_users in the alerts domain that accepts a message parameter and a list of user IDsset_brightness in the lighting domain that accepts a brightness level (0-100) and validates itThe service handlers should:
alerts.notify_users service succeeds and makes it available for invocation @testalerts.notify_users service with valid data executes successfully @testlighting.set_brightness service with validation succeeds @testlighting.set_brightness with brightness 50 succeeds @testlighting.set_brightness with brightness 150 raises a validation error @test@generates
import voluptuous as vol
from homeassistant.core import HomeAssistant, ServiceCall
from typing import Any, Dict
async def register_notify_service(hass: HomeAssistant) -> None:
"""Register the alerts.notify_users service."""
pass
async def register_brightness_service(hass: HomeAssistant) -> None:
"""Register the lighting.set_brightness service with validation."""
pass
async def call_service(hass: HomeAssistant, domain: str, service: str, service_data: Dict[str, Any]) -> None:
"""Call a registered service by domain and service name."""
pass
def check_service_exists(hass: HomeAssistant, domain: str, service: str) -> bool:
"""Check if a service is registered."""
pass
async def unregister_service(hass: HomeAssistant, domain: str, service: str) -> None:
"""Unregister a service from the registry."""
passProvides the service registry and core functionality for managing services.
Provides schema validation for service data.