Repository: home-assistant/core
File: homeassistant/components/intent/timers.py (Python)

Code before:
    """Error when multiple timers matched name or start time."""

    def __init__(self) -> None:
        """Initialize error."""
        super().__init__("Multiple timers matched", MULTIPLE_TIMERS_MATCHED_RESPONSE)


class TimersNotSupportedError(intent.IntentHandleError):
    """Error when a timer intent is used from a device that isn't registered to handle timer events."""

    def __init__(self, device_id: str | None = None) -> None:
        """Initialize error."""
        super().__init__(
            f"Device does not support timers: device_id={device_id}",
            NO_TIMER_SUPPORT_RESPONSE,
        )


class NoIntentMatchError(intent.IntentHandleError):
    """Error when a conversation command does not match any intent."""

    def __init__(self, command: str) -> None:
        """Initialize error."""
        super().__init__(
            f"No intent was matched for the provided command: {command}",
            NO_INTENT_MATCH_RESPONSE,
        )


class TimerManager:
    """Manager for intent timers."""

    def __init__(self, hass: HomeAssistant) -> None:
        """Initialize timer manager."""
        self.hass = hass

        # timer id -> timer
        self.timers: dict[str, TimerInfo] = {}
        self.timer_tasks: dict[str, asyncio.Task] = {}

        # device_id -> handler
        self.handlers: dict[str, TimerHandler] = {}

    def register_handler(
        self, device_id: str, handler: TimerHandler
    ) -> Callable[[], None]:
        """Register a timer handler.

        Returns a callable to unregister.
        """
        self.handlers[device_id] = handler

Review comment (suggestion):
```suggestion
            f"Timer command was not recognized: {command}",
            NO_TIMER_COMMAND_RESPONSE,
```

Code after:
    """Error when multiple timers matched name or start time."""

    def __init__(self) -> None:
        """Initialize error."""
        super().__init__("Multiple timers matched", MULTIPLE_TIMERS_MATCHED_RESPONSE)


class NoTimerCommandError(intent.IntentHandleError):
    """Error when a conversation command does not match any intent."""

    def __init__(self, command: str) -> None:
        """Initialize error."""
        super().__init__(
            f"Intent not recognized: {command}",
            NO_TIMER_COMMAND_RESPONSE,
        )


class TimersNotSupportedError(intent.IntentHandleError):
    """Error when a timer intent is used from a device that isn't registered to handle timer events."""

    def __init__(self, device_id: str | None = None) -> None:
        """Initialize error."""
        super().__init__(
            f"Device does not support timers: device_id={device_id}",
            NO_TIMER_SUPPORT_RESPONSE,
        )


class TimerManager:
    """Manager for intent timers."""

    def __init__(self, hass: HomeAssistant) -> None:
        """Initialize timer manager."""
        self.hass = hass

        # timer id -> timer
        self.timers: dict[str, TimerInfo] = {}
        self.timer_tasks: dict[str, asyncio.Task] = {}

        # device_id -> handler
        self.handlers: dict[str, TimerHandler] = {}

    def register_handler(
        self, device_id: str, handler: TimerHandler
    ) -> Callable[[], None]:
        """Register a timer handler.

        Returns a callable to unregister.
        """
        self.handlers[device_id] = handler