Skip to content

Exposing original configuration on switches - #1650

Open
jaynis wants to merge 3 commits into
basnijholt:mainfrom
jaynis:main
Open

jaynis wants to merge 3 commits into
basnijholt:mainfrom
jaynis:main

Conversation

@jaynis

@jaynis jaynis commented Oct 31, 2026

Copy link
Copy Markdown

Adds original_configuration attribute alongside configuration to preserve the persistent config values. When include_config_in_attributes is enabled, configuration reflects the live state (updated by change_switch_settings), while original_configuration always shows the persistent baseline from the config flow.

Fixes #1649

Signed-off-by: jaynis <kranz.jannis@googlemail.com>
@jaynis
jaynis requested a review from basnijholt as a code owner October 31, 2026 13:28
@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Low impact] The change affects configuration attributes on Adaptive Lighting's main switch.

The PR appears safe to merge, with a non-blocking fix needed to hide saved settings when configuration attributes are disabled.

Findings

  1. P2 Disabled attributes still show settings ▶

Summary

Adds original_configuration beside configuration so users can compare saved settings with temporary changes.

  • The main switch shows saved settings beside its live configuration.

Reviews (1) · Last reviewed commit: "exposing original configuration on switc..." · Reviewed by Greptile

extra_state_attributes: dict[str, Any] = {"configuration": self._config}
extra_state_attributes: dict[str, Any] = {
"configuration": self._config,
"original_configuration": self._original_config,

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.

P2 Disabled attributes still show settings

After include_config_in_attributes has been enabled, disabling it through change_switch_settings empties configuration but leaves original_configuration fully populated. Users still see their saved settings even though they turned configuration attributes off.

Return an empty dictionary for this attribute while the option is false. Add a regression test that enables then disables the option.

Suggested change
"original_configuration": self._original_config,
"original_configuration": (
self._original_config if self._include_config_in_attributes else {}
),

Knowledge Base Used: Switches and service controls

…bled

Signed-off-by: jaynis <kranz.jannis@googlemail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose original configuration alongside live configuration in switch attributes

1 participant