home-assistant/core · warning · ValueError
{self.entity_id} doesn't support learning RF commands
Error message
{self.entity_id} doesn't support learning RF commands What it means
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.
Source
Thrown at homeassistant/components/broadlink/remote.py:300
_LOGGER.warning(
"%s canceled: %s entity is turned off", service, self.entity_id
)
return
if not self._storage_loaded:
await self._async_load_storage()
async with self._lock:
if command_type == COMMAND_TYPE_IR:
learn_command = self._async_learn_ir_command
elif hasattr(device.api, "sweep_frequency"):
learn_command = self._async_learn_rf_command
else:
err_msg = f"{self.entity_id} doesn't support learning RF commands"
_LOGGER.error("Failed to call %s: %s", service, err_msg)
raise ValueError(err_msg)
should_store = False
for command in commands:
try:
code = await learn_command(command)
if toggle:
code = [code, await learn_command(command)]
# pylint: disable-next=home-assistant-action-swallowed-exception
except (AuthorizationError, NetworkTimeoutError, OSError) as err:
_LOGGER.error("Failed to learn '%s': %s", command, err)
break
except BroadlinkException as err:
_LOGGER.error("Failed to learn '%s': %s", command, err)
continue
View on GitHub (pinned to 58a3fdb3ea)
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.
Example fix
# before data: command_type: rf command: doorbell # on an RM mini 3 # after: learn as IR, or target RF-capable entity data: command_type: ir command: doorbell
Defensive patterns
Strategy: type-guard
Validate before calling
def can_learn_rf(device) -> bool:
"""Verify RF learning capability before invoking remote.learn_command."""
return hasattr(device.api, "sweep_frequency") Type guard
def is_rf_capable_remote(entity) -> bool:
"""Narrow remote entities to those with RF learning hardware."""
api = getattr(getattr(entity, "_device", None), "api", None)
return api is not None and hasattr(api, "sweep_frequency") Try / catch
try:
await hass.services.async_call("remote", "learn_command", data, blocking=True)
except ValueError as err:
if "doesn't support learning RF commands" in str(err):
data["command_type"] = "ir" # fall back to IR learning if that is the intent
await hass.services.async_call("remote", "learn_command", data, blocking=True)
else:
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- {self.entity_id} doesn't support sending RF commands
- You need to specify a device
- Command not found: {cmd!r}
- Invalid code: {code!r}
- No radiofrequency code received within {LEARNING_TIMEOUT.tot
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/e90eeaa0b5068bbb.
Report an issue: GitHub.