core icon indicating copy to clipboard operation
core copied to clipboard

Add modbus light brightness and color temperature

Open DioSWolF opened this issue 9 months ago β€’ 10 comments

This pull request introduces support for brightness and color temperature adjustments through switches. Previously, these functionalities were unavailable or required alternative implementations. Now, users can control brightness and color temperature directly using dedicated switches.

Breaking change

Proposed change

Added brightness control support. Implemented color temperature adjustments. Updated relevant logic to integrate these features with existing switch mechanisms. Ensured compatibility with the current Modbus setup in Home Assistant. Testing: Verified brightness adjustments work correctly through the switch. Tested color temperature changes to ensure seamless integration. Checked backward compatibility to avoid breaking existing functionality. Let me know if you need any modifications!

Type of change

  • [ ] Dependency upgrade
  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [ ] New integration (thank you!)
  • [x] 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: https://github.com/home-assistant/home-assistant.io/pull/37973
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • [x] The code change is tested and works locally.
  • [x] Local tests pass. Your PR cannot be merged unless tests pass
  • [x] There is no commented out code in this PR.
  • [x] I have followed the development checklist
  • [x] I have followed the perfect PR recommendations
  • [x] The code has been formatted using Ruff (ruff format homeassistant tests)
  • [x] Tests have been added to verify that the new code works.

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 link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

DioSWolF avatar Mar 03 '25 16:03 DioSWolF

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks :+1:

Learn more about our pull request process.

home-assistant[bot] avatar Mar 03 '25 16:03 home-assistant[bot]

I have some issues with documentation. Here is documentation for new functions but i don`t know how to find and update old modbus documentation for light

README.md

DioSWolF avatar Mar 11 '25 08:03 DioSWolF

I have some issues with documentation. Here is documentation for new functions but i don`t know how to find and update old modbus documentation for light

README.md

You have to fork the next branch of the home-assistant.io repo and make a PR, then you can link the PR to this one.

crug80 avatar Mar 11 '25 09:03 crug80

Moreoever.. format the code following ruff guidelines.

crug80 avatar Mar 12 '25 20:03 crug80

Hi! I missed something for review or all is good?

DioSWolF avatar Mar 21 '25 13:03 DioSWolF

Hey @DioSWolF ruff seems to be failing. Can you sort out? Please do mark the PR as Ready after fixing that by pressing the "Ready for review" button here on github. Thanks!

abmantis avatar Apr 21 '25 11:04 abmantis

Hey @DioSWolF , the CI is still failing. I really recommend that you setup the pre-commit hook or run it manually: https://developers.home-assistant.io/docs/development_testing/#preventing-linter-errors

abmantis avatar Apr 22 '25 14:04 abmantis

image image Here local pre-commit tests results

DioSWolF avatar Apr 23 '25 10:04 DioSWolF

test_color_temp_light is failing immagine

Moreover, the coverage of the light.py is only 94%. Lines 127 to 134 are not covered and they have been added by your PR, so they should be validated.

crug80 avatar Apr 23 '25 15:04 crug80

Before you take over PR, I learn a lot of things that I never noticed before in my work.😁 image And added WSL for Windows PC and updated it to use Python 3.13 and now i know how to work with it😁

DioSWolF avatar Apr 23 '25 17:04 DioSWolF

Thank you @abmantis !

DioSWolF avatar May 14 '25 10:05 DioSWolF