Skip to content

Add radio_frequency platform to ESPHome#168448

Merged
balloob merged 6 commits intodevfrom
esphome-radio-frequency
Apr 24, 2026
Merged

Add radio_frequency platform to ESPHome#168448
balloob merged 6 commits intodevfrom
esphome-radio-frequency

Conversation

@balloob
Copy link
Copy Markdown
Member

@balloob balloob commented Apr 17, 2026

Breaking change

Proposed change

Implement the new radio_frequency entity platform on ESPHome, mirroring the existing infrared platform pattern.

This PR relies on:

Opened as a draft because it depends on the linked PRs. Typing and linting will fail on things imported from the radio_frequency integration until #168447 lands; that is expected and can be ignored for now.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

balloob and others added 2 commits April 17, 2026 15:11
Implement the new radio_frequency platform on ESPHome, mirroring
the infrared platform pattern.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Always return frequency ranges from device info, matching the
updated RadioFrequencyTransmitterEntity contract.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 17, 2026 19:12
@home-assistant home-assistant Bot added cla-signed has-tests integration: esphome new-feature Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage Top 50 Integration is ranked within the top 50 by usage labels Apr 17, 2026
@home-assistant
Copy link
Copy Markdown
Contributor

Hey there @jesserockz, @kbx81, @bdraco, mind taking a look at this pull request as it has been labeled with an integration (esphome) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of esphome can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign esphome Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds ESPHome support for the new radio_frequency entity domain, following the existing ESPHome infrared platform structure so RF transmitters can be exposed and used via the shared abstraction layer.

Changes:

  • Introduce an ESPHome radio_frequency platform entity that can transmit raw RF timings via the native API.
  • Register RadioFrequencyInfoPlatform.RADIO_FREQUENCY mapping so ESPHome can dynamically set up the platform.
  • Add ESPHome tests covering entity creation by capabilities, transmit success/failure, availability transitions, and frequency-range filtering.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
homeassistant/components/esphome/radio_frequency.py New ESPHome platform implementation for RF transmitter entities and transmit command wiring.
homeassistant/components/esphome/entry_data.py Maps the new ESPHome API info type to the new HA platform for dynamic setup.
tests/components/esphome/test_radio_frequency.py Test coverage mirroring the existing infrared tests for transmitter behavior and API calls.

In rf-protocols 1.0.0, RadioFrequencyCommand.get_raw_timings() returns
a flat list[int] of signed alternating microseconds directly, so the
ESPHome platform can pass it straight through without unpacking Timing
objects.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 24, 2026 10:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@balloob balloob marked this pull request as ready for review April 24, 2026 13:26
Copilot AI review requested due to automatic review settings April 24, 2026 13:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Comment on lines +40 to +42
def supported_frequency_ranges(self) -> list[tuple[int, int]]:
"""Return supported frequency ranges from device info."""
return [(self._static_info.frequency_min, self._static_info.frequency_max)]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would have been nicer if this was a tuple of tuples since it should be immutable but base entity concern

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will migrate this in a future PR

timings=[350, -1050],
)

with pytest.raises(HomeAssistantError) as exc_info:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: match

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

match only regex-matches against str(exception), but here we're asserting on translation_domain and translation_key attributes, which aren't in the string form.

self._static_info.key,
frequency=command.frequency,
timings=timings,
modulation=MODULATION_TYPE_TO_ESPHOME[command.modulation],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will blow up with KeyError if add more but don't update here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now we're only supporting OOK modulation in all of HA. When we migrate to supporting other ones, we're going to add supported_modulations property, which will steer Home Assistant to limit to only valid modulations being passed in.

frequency=command.frequency,
timings=timings,
modulation=MODULATION_TYPE_TO_ESPHOME[command.modulation],
repeat_count=command.repeat_count + 1,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its not obvious why this is +1 here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment

@balloob balloob merged commit c4426b9 into dev Apr 24, 2026
32 of 33 checks passed
@balloob balloob deleted the esphome-radio-frequency branch April 24, 2026 14:48
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed code-owner-approved has-tests integration: esphome new-feature Quality Scale: platinum Top 50 Integration is ranked within the top 50 by usage Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Radio-frequency (RF) is becoming a first-class citizen of Home Assistant and can send commands

5 participants