{"record":{"id":"32765c9255177f98","repo":"home-assistant/core","slug":"no-infrared-code-received-within-learning-timeout","errorCode":null,"errorMessage":"No infrared code received within {LEARNING_TIMEOUT.total_seconds()} seconds","messagePattern":"No infrared code received within (.+?) seconds","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"warning","filePath":"homeassistant/components/broadlink/remote.py","lineNumber":353,"sourceCode":"\n        persistent_notification.async_create(\n            self.hass,\n            f\"Press the '{command}' button.\",\n            title=\"Learn command\",\n            notification_id=\"learn_command\",\n        )\n\n        try:\n            start_time = dt_util.utcnow()\n            while (dt_util.utcnow() - start_time) < LEARNING_TIMEOUT:\n                await asyncio.sleep(1)\n                try:\n                    code = await device.async_request(device.api.check_data)\n                except ReadError, StorageError:\n                    continue\n                return b64encode(code).decode(\"utf8\")\n\n            raise TimeoutError(\n                \"No infrared code received within \"\n                f\"{LEARNING_TIMEOUT.total_seconds()} seconds\"\n            )\n\n        finally:\n            persistent_notification.async_dismiss(\n                self.hass, notification_id=\"learn_command\"\n            )\n\n    async def _async_learn_rf_command(self, command):\n        \"\"\"Learn a radiofrequency command.\"\"\"\n        device = self._device\n\n        try:\n            await device.async_request(device.api.sweep_frequency)\n\n        except (BroadlinkException, OSError) as err:\n            _LOGGER.debug(\"Failed to sweep frequency: %s\", err)","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/broadlink/remote.py#L335-L371","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    code = await remote._async_learn_ir_command(command)\nexcept TimeoutError as err:\n    _LOGGER.warning(\"IR learn timed out: %s\", err)\n    raise HomeAssistantError(\"Press the remote button during the learning window\") from err","preventionTips":["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."],"tags":["home-assistant","broadlink","infrared","learning","timeout"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}