Skip to content
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

Hue: Remove incorrect dimming lower bound logic. #1832

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

dljsjr
Copy link
Contributor

@dljsjr dljsjr commented Dec 18, 2024

Type of Change

  • WWST Certification Request
    • If this is your first time contributing code:
      • I have reviewed the README.md file
      • I have reviewed the CODE_OF_CONDUCT.md file
      • I have signed the CLA
    • I plan on entering a WWST Certification Request or have entered a request through the WWST Certification console at developer.smartthings.com
  • Bug fix
  • New feature
  • Refactor

Checklist

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have verified my changes by testing with a device or have communicated a plan for testing
  • I am adding new behavior, such as adding a sub-driver, and have added and run new unit tests to cover the new behavior

Description of Change

This was some of the first code I wrote for the Hue driver, and I had a misunderstanding of the min_dimming property returned by the API.

The min_dimming value in the API is informative, and represents a percent of the total lumens the device is capable of outputting that you will get if you request the lowest possible brightness for the bulb (1%).

We were interpreting it as a lower bound on the values to send, which is not correct.

This PR removes the lower bound checks, and instead clamps all dimming commands to the range of [1,100] inclusive.

Summary of Completed Tests

Tested against all bulb profiles that we support.

Copy link

github-actions bot commented Dec 18, 2024

Channel deleted.

Copy link

github-actions bot commented Dec 18, 2024

Test Results

   64 files    402 suites   0s ⏱️
2 002 tests 2 002 ✅ 0 💤 0 ❌
3 456 runs  3 456 ✅ 0 💤 0 ❌

Results for commit 18ae4c5.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Dec 18, 2024

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 18ae4c5

@dljsjr dljsjr changed the title fix: Remove incorrect dimming logic. Hue: Remove incorrect dimming lower bound logic. Dec 19, 2024
This was some of the first code I wrote for the Hue driver, and I had
a misunderstanding of the `min_dimming` property returned by the API.

The `min_dimming` value in the API is informative, and represents a percent
of the total lumens the device is capable of outputting that you will get
if you request the lowest possible brightness for the bulb (1%).

We were interpreting it as a lower bound on the values to send, which is
not correct.

This PR removes the lower bound checks, and instead clamps all dimming commands
to the range of [1,100] inclusive.
@dljsjr dljsjr force-pushed the fix/improper-philips-hue-dimming-range branch from 598ee95 to 18ae4c5 Compare December 19, 2024 20:27
@dljsjr dljsjr merged commit ac0ebbb into main Dec 19, 2024
10 checks passed
@dljsjr dljsjr deleted the fix/improper-philips-hue-dimming-range branch December 19, 2024 20:29
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.

5 participants