Skip to content

Fix BEGA color temp channel unsupported check#737

Merged
TheJulianJES merged 2 commits intozigpy:devfrom
TheJulianJES:tjj/bega_fix_dimmable_only_select
Apr 9, 2026
Merged

Fix BEGA color temp channel unsupported check#737
TheJulianJES merged 2 commits intozigpy:devfrom
TheJulianJES:tjj/bega_fix_dimmable_only_select

Conversation

@TheJulianJES
Copy link
Copy Markdown
Contributor

Proposed change

This fixes an issue where the "Color temperature channel" select entity for BEGA lights was created, even if the light driver only supports one color temperature channel. On truly "dimmable only" lights with one driver channel only, one attribute still has the correct color temperature (e.g. 3000K), with the other one being set to 0xFFFF.

To fix this, we just do not create the select entity if either driver channel's color temperature is 0xFFFF.

Additional information

Follow-up to:

To note again: These lights are not tunable color temperature lights. They can only be fixed to either 3000K or 4000K (depends on exact model). So, this cannot be represented in the Home Assistant light entity model and an extra select entity is needed to switch the driver channel. See the above PR for more notes on this.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.63%. Comparing base (696ab1c) to head (bae74e8).
⚠️ Report is 4 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #737   +/-   ##
=======================================
  Coverage   97.63%   97.63%           
=======================================
  Files          62       62           
  Lines       10814    10814           
=======================================
  Hits        10558    10558           
  Misses        256      256           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TheJulianJES TheJulianJES marked this pull request as ready for review April 4, 2026 20:11
Copilot AI review requested due to automatic review settings April 4, 2026 20:11
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 fixes BEGA “Color temperature channel” select entity creation by treating the feature as unsupported when either of the two reported switchable color temperature attributes is 0xFFFF, preventing the select entity from being created on single-channel (“dimmable only”) BEGA lights.

Changes:

  • Update BEGA select entity support check to skip entity creation when switchable_color_temperature_1 or _2 equals 0xFFFF.
  • Adjust debug log message to match the new condition.
  • Expand test coverage to ensure the select entity is not created when either (or both) temp attributes are 0xFFFF.

Reviewed changes

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

File Description
zha/application/platforms/select.py Fixes _is_supported() logic for BEGA color temp channel select creation.
tests/test_select.py Adds parametrized test cases covering partial-unsupported (0xFFFF) scenarios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"""Test BEGA select entity is not created when a color temp is 0xFFFF."""
zigpy_device = await zigpy_device_from_json(
zha_gateway.application_controller,
"tests/data/devices/bega-gantenbrink-leuchten-kg-smart-dimmable-light.json",
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.

Note: Almost all BEGA lights are named "Smart Dimmable Light". Some of those are only dimmable, others support two color temperature channels. For the latter ones only, the select entity should be created.

I've not added a second diagnostics file for now, since it's kind of hard to distinguish them. Other than the two color temperature channel attributes, only the product_code attribute would differ when read.

I think this test covers it well enough by just updating the attribute (cache), before joining the device.
Side note: It would be nice to have a better way to populate the attribute cache when read for zigpy_device_from_json.

@TheJulianJES TheJulianJES merged commit 8a0dac0 into zigpy:dev Apr 9, 2026
13 checks passed
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.

2 participants