Skip to content

Use dedicated power commands for LG infrared#168488

Merged
edenhaus merged 2 commits intodevfrom
lg-infrared-dedicated-power
Apr 20, 2026
Merged

Use dedicated power commands for LG infrared#168488
edenhaus merged 2 commits intodevfrom
lg-infrared-dedicated-power

Conversation

@balloob
Copy link
Copy Markdown
Member

@balloob balloob commented Apr 18, 2026

Breaking change

Proposed change

It was using the power toggle command instead of dedicated power on/off commands.

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:

Copilot AI review requested due to automatic review settings April 18, 2026 11:09
@balloob balloob requested a review from a team as a code owner April 18, 2026 11:09
@home-assistant
Copy link
Copy Markdown

Hey there @home-assistant/core, 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.

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

This PR updates the LG Infrared media player to use discrete power on/off IR commands instead of a power toggle, aligning service behavior with explicit on/off intent.

Changes:

  • Switch async_turn_on to send LGTVCode.POWER_ON instead of LGTVCode.POWER.
  • Switch async_turn_off to send LGTVCode.POWER_OFF instead of LGTVCode.POWER.

Comment thread homeassistant/components/lg_infrared/media_player.py
Comment thread homeassistant/components/lg_infrared/media_player.py
@balloob
Copy link
Copy Markdown
Member Author

balloob commented Apr 18, 2026

@copilot fix test

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 18, 2026

@copilot fix test

Fixed in dc7117bd: updated tests/components/lg_infrared/test_media_player.py to expect LGTVCode.POWER_ON for turn_on and LGTVCode.POWER_OFF for turn_off.

Copy link
Copy Markdown
Member

@edenhaus edenhaus left a comment

Choose a reason for hiding this comment

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

Thanks @balloob 👍

@edenhaus edenhaus merged commit cdecff9 into dev Apr 20, 2026
55 of 56 checks passed
@edenhaus edenhaus deleted the lg-infrared-dedicated-power branch April 20, 2026 13:36
zxdavb pushed a commit to zxdavb/hass that referenced this pull request Apr 20, 2026
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: balloob <1444314+balloob@users.noreply.github.com>
Copy link
Copy Markdown
Member

@abmantis abmantis left a comment

Choose a reason for hiding this comment

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

This now always sends turn_off, since the interface only shows 1 button, right?
The UI should show separate On/Off buttons when assumed_state = True.

Alternatively, we could toggle _attr_state in turn_on() and turn_off(), but that is a worse UX than just sending POWER all the times instead.

@balloob
Copy link
Copy Markdown
Member Author

balloob commented Apr 20, 2026

Yeah, we do this for light already. We should do this in the frontend too for media player turn on/off buttons.

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.

5 participants