Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Do not return empty string for custom light effect name #1491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

sdb9696
Copy link
Collaborator

@sdb9696 sdb9696 commented Jan 29, 2025

Fixes HA Issue 134568

Issue caused when a custom effect has an empty string for a name. Causes the HA __validate_color_mode to treat as no effect active:

if not effect or effect == EFFECT_OFF:
    # No effect is active, the light must set color mode to one of the supported
    # color modes
    if color_mode in supported_color_modes:
        return

but the integration tests for != LightEffect.LIGHT_EFFECTS_OFF when deciding on the color mode:

if effect_module.effect != LightEffect.LIGHT_EFFECTS_OFF:
    self._attr_effect = effect_module.effect
    self._attr_color_mode = ColorMode.BRIGHTNESS
else:

As the effect is in fact on, we should not return empty string for effect name.

Copy link

codecov bot commented Jan 29, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 92.63%. Comparing base (09e73fa) to head (e3bdc65).
Report is 15 commits behind head on master.

Files with missing lines Patch % Lines
kasa/smart/modules/lightstripeffect.py 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1491      +/-   ##
==========================================
- Coverage   92.64%   92.63%   -0.02%     
==========================================
  Files         149      149              
  Lines        9428     9431       +3     
  Branches      957      958       +1     
==========================================
+ Hits         8735     8736       +1     
- Misses        497      498       +1     
- Partials      196      197       +1     

☔ 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.

@sdb9696 sdb9696 requested a review from rytilahti January 29, 2025 16:24
Copy link
Member

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

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

LGTM, feel free to improve the coverage or merge as is, your call!

@sdb9696
Copy link
Collaborator Author

sdb9696 commented Jan 29, 2025

Yeah I thought about coverage, but hard to really test without hacking something low value together.

@sdb9696 sdb9696 merged commit 82fbe12 into master Jan 29, 2025
16 of 18 checks passed
@sdb9696 sdb9696 deleted the fix/light_effect_name branch January 29, 2025 18:49
@sdb9696 sdb9696 mentioned this pull request Jan 31, 2025
sdb9696 added a commit that referenced this pull request Feb 2, 2025
## [0.10.1](https://github.com/python-kasa/python-kasa/tree/0.10.1) (2025-02-02)

[Full Changelog](0.10.0...0.10.1)

**Release summary:**

Small patch release for bugfixes

**Implemented enhancements:**

- dustbin\_mode: add 'off' mode for cleaner downstream impl [\#1488](#1488) (@rytilahti)
- Add Dimmer Configuration Support [\#1484](#1484) (@ryenitcher)

**Fixed bugs:**

- Do not return empty string for custom light effect name [\#1491](#1491) (@sdb9696)
- Add FeatureAttributes to smartcam Alarm [\#1489](#1489) (@sdb9696)

**Project maintenance:**

- Add module.device to the public api [\#1478](#1478) (@sdb9696)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TP-Link (KL420L5 LED strip) set to unsupported color mode brightness
2 participants