Add Broadlink infrared emitter support#168889
Conversation
|
Hey there @Danielhiversen, @felipediel, @L-I-Am, @eifinger, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Pull request overview
Adds Broadlink RM-series IR emitter support to Home Assistant’s native infrared platform, enabling Broadlink devices to transmit infrared_protocols commands through a dedicated infrared entity.
Changes:
- Add a new Broadlink
infraredplatform entity that encodes raw timings into Broadlink IR packets and sends them viasend_data. - Forward
Platform.INFRAREDonly for IR-capable Broadlink RM device types. - Add translations and tests covering entity creation, command sending, and error translation behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
homeassistant/components/broadlink/infrared.py |
Implements Broadlink InfraredEntity that converts timings to Broadlink packets and transmits them. |
homeassistant/components/broadlink/const.py |
Adds Platform.INFRARED to the forwarded platforms for RM device types. |
homeassistant/components/broadlink/strings.json |
Adds entity name translation and a translated exception message for send failures. |
tests/components/broadlink/test_infrared.py |
Adds tests for IR entity setup, send behavior, and error translation mapping. |
0319c03 to
7a44b47
Compare
| def __init__(self, device: BroadlinkDevice) -> None: | ||
| """Initialize the entity.""" | ||
| super().__init__(device) | ||
| self._attr_unique_id = f"{device.unique_id}-infrared" |
There was a problem hiding this comment.
we don't need to add infrared as unique ids are unique per integration pet platform
abmantis
left a comment
There was a problem hiding this comment.
LGTM, just some minor suggestions
| ] | ||
| assert len(infrared_entities) == 1 | ||
| assert infrared_entities[0].unique_id == device.mac | ||
| assert mock_setup.api.auth.call_count == 1 |
There was a problem hiding this comment.
| assert mock_setup.api.auth.call_count == 1 |
is this related to the infrared platform?
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Breaking change
Proposed change
Adds infrared transmitter support for Broadlink RM devices (RM4MINI, RM4PRO, RMMINI, RMMINIB, RMPRO) to Home Assistant's native infrared platform.
Type of change
Additional information
Reintroduces Broadlink infrared emitter support on the native
infraredplatform. Follow-up to #168385 (reverted in #168717) that addresses all
review feedback before re-landing.
Changes vs. the reverted PR:
Drop
BroadlinkIRCommand. The speculative subclass had no UI/YAMLpath and couldn't be constructed by standard consumers
Rewrite tests against the public dispatcher. Tests now call
homeassistant.components.infrared.async_send_commandand assert onmock_setup.api.send_data, instead of reaching into integrationinternals
Remove
"dependencies": ["infrared"]from the manifest. OnlyIR-capable RM models get
Platform.INFRAREDforwarded viaDOMAINS_AND_TYPES, so every non-IR Broadlink device no longer paysfor loading the infrared base integration (feedback from Copilot).
Tested on: TCL 49C2US TV via Broadlink RM4 remote (power, volume, source commands verified working)
This PR fixes or closes issue: fixes #
This PR is related to issue: This PR is a follow up to previous PR which was reverted
Link to documentation pull request: Document Broadlink Infrared integration support home-assistant.io#44968
Link to developer documentation pull request:
Link to frontend pull request:
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: