Add LG AC support to lg_infrared integration#174142
Conversation
- Updated entity initialization to accept device names. - Enhanced configuration flow to support AC setup with HVAC modes. - Implemented tests for AC functionality, including HVAC mode switching and temperature settings.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
|
Hey there @abmantis, 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
Note
Copilot was unable to run its full agentic suite in this review.
This PR adds LG AC (air conditioner) support to the LG Infrared integration, introducing a climate platform with IR encoding/decoding, a multi-step config flow for device type selection, and a reconfigure flow.
Changes:
- New
climate.pyplatform andac_encoder.pymodule for encoding/decoding LG AC 28-bit IR protocol commands (cool, heat, dry, fan-only, off) - Refactored config flow into a multi-step process: device type selection → device-specific configuration (TV or AC), plus a new reconfigure flow
- Added comprehensive tests for the climate platform, encoder/decoder, and updated config flow tests
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| homeassistant/components/lg_infrared/init.py | Added Platform.CLIMATE to the platforms list |
| homeassistant/components/lg_infrared/const.py | Added AC-related constants (HVAC modes, temp range, fan quiet, AC device type) |
| homeassistant/components/lg_infrared/entity.py | Added _entry attribute and configurable device_name to base entity |
| homeassistant/components/lg_infrared/config_flow.py | Refactored into multi-step flow with TV/AC/reconfigure steps |
| homeassistant/components/lg_infrared/climate.py | New climate entity for LG AC with IR emitter/receiver support |
| homeassistant/components/lg_infrared/ac_encoder.py | New LG 28-bit IR protocol encoder/decoder |
| homeassistant/components/lg_infrared/strings.json | Added strings for AC flow, reconfigure flow, climate entity, and HVAC mode selector |
| homeassistant/components/lg_infrared/quality_scale.yaml | Updated reconfiguration-flow status to "done" |
| tests/components/lg_infrared/conftest.py | Added AC-specific mock config entries and integration fixtures |
| tests/components/lg_infrared/test_config_flow.py | Updated tests for multi-step flow and added AC/reconfigure flow tests |
| tests/components/lg_infrared/test_climate.py | New comprehensive tests for climate platform and encoder |
| tests/components/lg_infrared/snapshots/test_climate.ambr | Snapshot for climate entity state |
# Conflicts: # homeassistant/components/lg_infrared/config_flow.py # tests/components/lg_infrared/test_config_flow.py
|
due to moving the encoder file to other lib which is still not merged, pylint is throwing error. however checking out this branch locally and installing the lib from pr directly passes. |
|
Thanks for addressing the comments @Dr-Blank ! However, we should keep the PR in draft until the infrared-protocols library is updated with the new stuff. |
|
I a also write encoder for LG Climate with many command support. May be someone need (yoy may use it for free) https://github.com/slavonnet/EasyIR/blob/dev/custom_components/easyir/protocols/lg_p12rk/engine.py |
- Decode received frames with LgAcCommand.from_raw_timings() and read command.temperature. The old code read the removed state.temp_c, which was why a received frame never updated the entity and it stayed on OFF. - Add MEDIUM_LOW and MEDIUM_HIGH fan speeds, which the library now sends, with their translations and capability entries. The old decode fell back to AUTO for any unmapped speed and silently dropped them. - Preserve the last known fan and temperature across a power-off frame, which the library decodes with both unset; otherwise powering off would reset them. - Ignore a received frame whose HVAC mode the user has not configured. - Import MIN_TEMP/MAX_TEMP from the library and drop the const re-export.
|
failure seems unrelated to this PR fix in #176573 |
| "documentation": "https://www.home-assistant.io/integrations/infrared", | ||
| "integration_type": "entity", | ||
| "quality_scale": "internal", | ||
| "requirements": ["infrared-protocols==7.0.0"] |
There was a problem hiding this comment.
We should do a dependency bump in a separate PR containing only the changes that are strictly necessary for the bump, as noted in point 7 of our Review Process documentation.
I've triggered the renovate bot to open the bump PR, but your fix PR should be merged first.
There was a problem hiding this comment.
removed bump in this PR
# Conflicts: # homeassistant/components/infrared/manifest.json # requirements.txt # requirements_all.txt
Breaking change
none
Proposed change
Adds LG air conditioner (AC) support to the
lg_infraredintegration via a newclimateplatform.climateentity controlling LG AC over infrared, supporting HVAC modeswitching and target temperature.
ac_encoder.pybuilding the LG AC IR command codes.Type of change
Additional information
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: