Skip to content

Add LG AC support to lg_infrared integration#174142

Draft
Dr-Blank wants to merge 15 commits into
home-assistant:devfrom
Dr-Blank:feat-lg-ac-infrared
Draft

Add LG AC support to lg_infrared integration#174142
Dr-Blank wants to merge 15 commits into
home-assistant:devfrom
Dr-Blank:feat-lg-ac-infrared

Conversation

@Dr-Blank

@Dr-Blank Dr-Blank commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Breaking change

none

Proposed change

Adds LG air conditioner (AC) support to the lg_infrared integration via a new
climate platform.

  • New climate entity controlling LG AC over infrared, supporting HVAC mode
    switching and target temperature.
  • New ac_encoder.py building the LG AC IR command codes.
  • Config flow extended to set up AC devices, including HVAC mode selection as some models do not support heat.

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

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:

- 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.

@home-assistant home-assistant Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @Dr-Blank

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant home-assistant Bot marked this pull request as draft June 17, 2026 18:39
@home-assistant

Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant

Copy link
Copy Markdown
Contributor

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

Code owner commands

Code owners of lg_infrared 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 lg_infrared 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.py platform and ac_encoder.py module 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

Comment thread tests/components/lg_infrared/test_climate.py Outdated
Comment thread homeassistant/components/lg_infrared/config_flow.py Outdated
Comment thread homeassistant/components/lg_infrared/config_flow.py Outdated
Dr-Blank added 2 commits June 17, 2026 18:54
# Conflicts:
#	homeassistant/components/lg_infrared/config_flow.py
#	tests/components/lg_infrared/test_config_flow.py
Copilot AI review requested due to automatic review settings June 17, 2026 19:28
Comment thread homeassistant/components/lg_infrared/ac_encoder.py Outdated
Comment thread homeassistant/components/lg_infrared/config_flow.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft June 23, 2026 15:43
@Dr-Blank

Copy link
Copy Markdown
Contributor Author

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.

@Dr-Blank Dr-Blank marked this pull request as ready for review June 23, 2026 20:41
@home-assistant home-assistant Bot requested a review from abmantis June 23, 2026 20:41
@abmantis abmantis marked this pull request as draft June 23, 2026 21:46
@abmantis

Copy link
Copy Markdown
Member

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.

@slavonnet

slavonnet commented Jul 3, 2026

Copy link
Copy Markdown

- 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.

@home-assistant home-assistant Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is a merge conflict.

@Dr-Blank

Dr-Blank commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

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"]

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.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed bump in this PR

Dr-Blank added 2 commits July 16, 2026 09:52
# Conflicts:
#	homeassistant/components/infrared/manifest.json
#	requirements.txt
#	requirements_all.txt
@Dr-Blank Dr-Blank requested a review from abmantis July 16, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants