Add light.adjust service/action#173239
Conversation
|
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
|
Hey there @home-assistant/core, 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 55898c6ec5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| raw_params = dict(call.data["params"]) | ||
|
|
||
| if light.__class__.async_adjust is not LightEntity.async_adjust: | ||
| params = filter_turn_on_params(light, raw_params) |
There was a problem hiding this comment.
Convert color params before filtering group adjust
When light.adjust targets a LightGroup, this branch filters the raw service params before running the normal color-space conversion. For an on group whose members support only HS/XY/color-temp/RGBWW, a documented field like rgb_color is removed by filter_turn_on_params() because the group itself does not support RGB, so params becomes empty and the adjust is silently skipped instead of being converted and forwarded to the active members. This means group adjust does not support the same color alternatives exposed in services.yaml and handled by light.turn_on.
Useful? React with 👍 / 👎.
|
I'll close here since the architecture discussion isn't resolved. Thanks for your willingness to contribute! |
|
Understood. Closing this pending architecture approval is fair. I reworked the architecture discussion into the explicit proposal shape previously requested: Continuing here: This PR can still serve as implementation/reference material, since it already covers the tricky group edge cases and shows the proposal is technically viable. |
Summary
Adds a new
light.adjustservice/action to the light domain for attribute-only light changes without turning on lights that are currently off.This is implemented conservatively:
async_adjustonThis PR is paired with the frontend PR that calls
light.adjustfrom group light controls:This proposal shape follows the recent architecture discussion comment:
Why
Recent frontend UX improvements made HA light groups a natural room-level control surface. In that UI, changing brightness or color-related attributes on a partially-on group should adjust the active lights in the group, not wake up members that are currently off.
Using
light.turn_onfor that intent is too broad because it inherently carries a power-on semantic.light.adjustgives the frontend and automations a precise action for "change attributes, but do not turn on currently-off lights".What Changed
light.adjustservice schema and handlerLightEntity.async_adjustLightGroup.async_adjusttarget only currently-on membersstrings.jsonandicons.jsonEdge Cases Resolved
adjust-only selectors fromlight.turn_onmetadata so the action UI does not advertise unsupported fields thereasync_adjust()handlers do not observe shared mutation across group membersbrightness_stepandbrightness_step_pctsemantics when a group fans out to active members with different current brightnessall: truelight groups on adjust-only semantics without waking members that are currently offcolor_namewhenlight.adjustis combined with step-based brightness changes on groupsprocess_turn_on_params()during custom groupasync_adjust()handlingRelation To Frontend
This core change is intentionally paired with a frontend caller change. On its own, this PR provides the backend semantics and service metadata. The companion frontend PR updates group light controls to use
light.adjustwhen the entity is a Home Assistant light group with member entities, while preservinglight.turn_onfor off or fully-off groups.That frontend PR should land together with this one, or after this one.
Testing
services.yamlparse checkgit diff --checktests/components/group/test_light.pytests/components/light/test_init.pyReferences