Skip to content

Cleanup broken switch entities for Hue automations - #177671

Open
marcelveldt wants to merge 3 commits into
devfrom
hue-remove-device-automations
Open

Cleanup broken switch entities for Hue automations#177671
marcelveldt wants to merge 3 commits into
devfrom
hue-remove-device-automations

Conversation

@marcelveldt

@marcelveldt marcelveldt commented Jul 30, 2026

Copy link
Copy Markdown
Member

Proposed change

Home Assistant adds an "Automation: " switch for every automation stored
on the Hue bridge. Most of those are not automations you can find in the Hue
app, but the button settings of your dimmer switches, wall switches and tap
dials, plus some internal entertainment settings. The bridge refuses to switch
those off, and when it does accept the change the accessory simply keeps
working, so those switches never did anything.

  • Only add automation switches for automations that also show up in the Hue app
  • Remove the switches that were added earlier for accessories and entertainment
  • Added tests

Note that I deliberatly did not mark this as a breaking change although we are removing entities because these entities were non functional anyways and deeply hidden behind the hue bridge device. It is a fix to cleanup some (long overdue) wrong state.

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 July 30, 2026 18:12
@home-assistant home-assistant Bot added bugfix cla-signed has-tests integration: hue Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage Top 50 Integration is ranked within the top 50 by usage by-code-owner Quality Scale: No score labels Jul 30, 2026

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

Filters non-user-facing Hue behavior instances and removes their stale switches.

Changes:

  • Excludes accessory and entertainment behavior scripts.
  • Cleans up previously registered entities.
  • Adds coverage for filtering and cleanup.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
homeassistant/components/hue/switch.py Filters internal automations and removes stale entities.
tests/components/hue/test_switch.py Tests filtering and registry cleanup.
tests/components/hue/const.py Adds behavior resource fixtures.

Copilot AI review requested due to automatic review settings July 30, 2026 18:46

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

tests/components/hue/test_switch.py:181

  • Remove these comments because they only restate the assertions immediately below them.
    # the internal instance is not exposed
    assert hass.states.get("switch.philips_hue_automation_wall_switch_hallway") is None
    # while a regular automation still is
    assert hass.states.get("switch.philips_hue_automation_timer_test") is not None

@marcelveldt
marcelveldt marked this pull request as ready for review July 30, 2026 18:50
Copilot AI review requested due to automatic review settings July 30, 2026 18:51

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

tests/components/hue/test_switch.py:163

  • Specify the metadata mapping types as dict[str, str]; the bare dict leaves its contents as Any, contrary to the concrete test-parameter typing convention in AGENTS.md:31-32.
    metadata: dict,

Copilot AI review requested due to automatic review settings July 30, 2026 23:37
@marcelveldt
marcelveldt force-pushed the hue-remove-device-automations branch from d217ca2 to 71d2ed1 Compare July 30, 2026 23:37
@marcelveldt
marcelveldt changed the base branch from dev to marcelveldt-aiohue-4-9-0 July 30, 2026 23:37

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

tests/components/hue/test_switch.py:163

  • Specify the metadata element types as dict[str, str]; the bare dict leaves its keys and values as Any, contrary to the test typing convention in AGENTS.md:31-32.
    metadata: dict,

@github-actions

Copy link
Copy Markdown

Check requirements

Checked at commit 71d2ed1.

No tracked requirement changes detected. ✅

Generated by Check requirements (AW) · 30.9 AIC · ⌖ 12.4 AIC · ⊞ 31.5K ·

Base automatically changed from marcelveldt-aiohue-4-9-0 to dev July 30, 2026 23:55
Bridges that do not report a script category ended up with a switch again,
which is the useless switch this change is removing. Require the automation
category instead, so an unknown or missing category means no switch.
@marcelveldt
marcelveldt force-pushed the hue-remove-device-automations branch from 71d2ed1 to e23bdf8 Compare July 30, 2026 23:57
@marcelveldt marcelveldt changed the title Remove Hue automations that cannot be turned on or off Cleanup broken switch entities for Hue automations Jul 31, 2026
@marcelveldt marcelveldt added this to the 2026.8.0 milestone Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix by-code-owner cla-signed has-tests integration: hue Quality Scale: No score Top 50 Integration is ranked within the top 50 by usage Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants