home-assistant/core · warning · TimeoutError
No infrared code received within {LEARNING_TIMEOUT.total_sec
Error message
No infrared code received within {LEARNING_TIMEOUT.total_seconds()} seconds What it means
TimeoutError raised by _async_learn_ir_command: the loop polls device.api.check_data once per second until LEARNING_TIMEOUT elapses; if no data arrives (ReadError/StorageError from check_data just continue), it gives up with this message. The persistent notification is dismissed in the finally block either way.
Source
Thrown at homeassistant/components/broadlink/remote.py:353
persistent_notification.async_create(
self.hass,
f"Press the '{command}' button.",
title="Learn command",
notification_id="learn_command",
)
try:
start_time = dt_util.utcnow()
while (dt_util.utcnow() - start_time) < LEARNING_TIMEOUT:
await asyncio.sleep(1)
try:
code = await device.async_request(device.api.check_data)
except ReadError, StorageError:
continue
return b64encode(code).decode("utf8")
raise TimeoutError(
"No infrared code received within "
f"{LEARNING_TIMEOUT.total_seconds()} seconds"
)
finally:
persistent_notification.async_dismiss(
self.hass, notification_id="learn_command"
)
async def _async_learn_rf_command(self, command):
"""Learn a radiofrequency command."""
device = self._device
try:
await device.async_request(device.api.sweep_frequency)
except (BroadlinkException, OSError) as err:
_LOGGER.debug("Failed to sweep frequency: %s", err)View on GitHub (pinned to 58a3fdb3ea)
Solutions
- Retry the learn and press the button within the timeout, 1–5 cm from the Broadlink in dim light.
- Hold the remote close and press firmly; try multiple presses/angles for short-burst protocols.
- Replace batteries in the original remote.
- Retry when no transmission is in progress and avoid double-triggering automations that call learn_command concurrently.
Defensive patterns
Strategy: try-catch
Try / catch
try:
code = await remote._async_learn_ir_command(command)
except TimeoutError as err:
_LOGGER.warning("IR learn timed out: %s", err)
raise HomeAssistantError("Press the remote button during the learning window") from err Prevention
- Press the button on the original remote immediately after learning starts and hold the remote 1–5 cm away.
- Avoid bright sunlight and interfering IR sources while learning.
- Announce the learning window duration to users in automations that wrap learn_command.
When it happens
Trigger: remote.learn_command started, the user never pressed a button on the original remote (or pointed it away) before LEARNING_TIMEOUT expired, or the device could not capture the signal (weak/very short bursts, sunlight interference).
Common situations: User walks away during learning, wrong remote grabbed, battery-dead original remote, learning in bright sunlight or at bad angle/distance, HA busy so the 1-second polling loop is starved.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- No radiofrequency found within {LEARNING_TIMEOUT.total_secon
- send_command_failed
- No radiofrequency code received within {LEARNING_TIMEOUT.tot
- Failed to connect
- {address}: {ex}
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/32765c9255177f98.
Report an issue: GitHub.