{"record":{"id":"e90eeaa0b5068bbb","repo":"home-assistant/core","slug":"self-entity-id-doesn-t-support-learning-rf-comma","errorCode":null,"errorMessage":"{self.entity_id} doesn't support learning RF commands","messagePattern":"(.+?) doesn't support learning RF commands","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"homeassistant/components/broadlink/remote.py","lineNumber":300,"sourceCode":"            _LOGGER.warning(\n                \"%s canceled: %s entity is turned off\", service, self.entity_id\n            )\n            return\n\n        if not self._storage_loaded:\n            await self._async_load_storage()\n\n        async with self._lock:\n            if command_type == COMMAND_TYPE_IR:\n                learn_command = self._async_learn_ir_command\n\n            elif hasattr(device.api, \"sweep_frequency\"):\n                learn_command = self._async_learn_rf_command\n\n            else:\n                err_msg = f\"{self.entity_id} doesn't support learning RF commands\"\n                _LOGGER.error(\"Failed to call %s: %s\", service, err_msg)\n                raise ValueError(err_msg)\n\n            should_store = False\n\n            for command in commands:\n                try:\n                    code = await learn_command(command)\n                    if toggle:\n                        code = [code, await learn_command(command)]\n\n                # pylint: disable-next=home-assistant-action-swallowed-exception\n                except (AuthorizationError, NetworkTimeoutError, OSError) as err:\n                    _LOGGER.error(\"Failed to learn '%s': %s\", command, err)\n                    break\n\n                except BroadlinkException as err:\n                    _LOGGER.error(\"Failed to learn '%s': %s\", command, err)\n                    continue\n","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/broadlink/remote.py#L282-L318","documentation":"ValueError('<entity_id> doesn't support learning RF commands') from _async_learn_command: when command_type is RF but the device API has no sweep_frequency method, there is no way to learn RF and the service raises before attempting anything. IR learning is unaffected because it is selected first when command_type == COMMAND_TYPE_IR.","triggerScenarios":"Calling remote.learn_command with command_type: rf on an IR-only Broadlink device (e.g. RM mini 3): hasattr(device.api, 'sweep_frequency') is False.","commonSituations":"Following guides written for RM Pro/RM4 Pro while owning an IR-only model, misreading device specs, mixed fleets of Broadlink devices in one HA install.","solutions":["Use an RF-capable Broadlink model (RM Pro / RM4 Pro) to learn RF commands.","Double-check command_type — leave it as the default IR unless you truly need RF.","If the device is RF-capable but unrecognized, update the broadlink library and HA core.","Consider an SDR or dedicated RF tool for non-Broadlink-band protocols."],"exampleFix":"# before\ndata:\n  command_type: rf\n  command: doorbell\n# on an RM mini 3\n\n# after: learn as IR, or target RF-capable entity\ndata:\n  command_type: ir\n  command: doorbell","handlingStrategy":"type-guard","validationCode":"def can_learn_rf(device) -> bool:\n    \"\"\"Verify RF learning capability before invoking remote.learn_command.\"\"\"\n    return hasattr(device.api, \"sweep_frequency\")","typeGuard":"def is_rf_capable_remote(entity) -> bool:\n    \"\"\"Narrow remote entities to those with RF learning hardware.\"\"\"\n    api = getattr(getattr(entity, \"_device\", None), \"api\", None)\n    return api is not None and hasattr(api, \"sweep_frequency\")","tryCatchPattern":"try:\n    await hass.services.async_call(\"remote\", \"learn_command\", data, blocking=True)\nexcept ValueError as err:\n    if \"doesn't support learning RF commands\" in str(err):\n        data[\"command_type\"] = \"ir\"  # fall back to IR learning if that is the intent\n        await hass.services.async_call(\"remote\", \"learn_command\", data, blocking=True)\n    else:\n        raise","preventionTips":["Default command_type to IR; request RF only on Pro-class devices.","Check device specs before attempting RF learning.","Automate capability checks when multiple Broadlink models coexist."],"tags":["home-assistant","broadlink","remote","hardware-limit"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}