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

Extend knx brightness with rgb brightness if brightness addresses are not supported #31496

Closed
wants to merge 1 commit into from
Closed

Conversation

FredericMa
Copy link
Contributor

Proposed change

In the documentation of the KNX light is an example to configure a RGB light. This also includes the group addresses for the brightness. My LED controllers only have color addresses (DPT 232.600) and no brightness addresses. So in this case I only configure the color addresses. The consequence is that there is no correct feedback on the set brightness on the color DPT. ALso, if I change the color, the brightness does a fallback to the default brightness (255):
https://github.com/home-assistant/home-assistant/blob/bea7aae8cd87aaef58359383d8c0ac0c34ef6abd/homeassistant/components/knx/light.py#L293-L294

The change proposed provides feedback on the brightness of the selected color and if only the color is changed, it gets the current brightness and doesn't fall back to the default brightness anymore. So 2 fixes for the price of one. 😉

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)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

# Example configuration.yaml for RGB without dedicated brightness addresses:
  - platform: knx
    name: Test RGB
    address: '0/5/6'
    state_address: '3/4/6'
    color_address: '0/5/7'
    color_state_address: '3/4/7'

Additional information

  • There is no issue recorded for this bug.

Checklist

  • 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
  • The code has been formatted using Black (black --fast homeassistant tests)
  • 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.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

@homeassistant
Copy link
Contributor

Hello @FredericMa,

When attempting to inspect the commits of your pull request for CLA signature status among all authors we encountered commit(s) which were not linked to a GitHub account, thus not allowing us to determine their status(es).

The commits that are missing a linked GitHub account are the following:

Unfortunately, we are unable to accept this pull request until this situation is corrected.

Here are your options:

  1. If you had an email address set for the commit that simply wasn't linked to your GitHub account you can link that email now and it will retroactively apply to your commits. The simplest way to do this is to click the link to one of the above commits and look for a blue question mark in a blue circle in the top left. Hovering over that bubble will show you what email address you used. Clicking on that button will take you to your email address settings on GitHub. Just add the email address on that page and you're all set. GitHub has more information about this option in their help center.

  2. If you didn't use an email address at all, it was an invalid email, or it's one you can't link to your GitHub, you will need to change the authorship information of the commit and your global Git settings so this doesn't happen again going forward. GitHub provides some great instructions on how to change your authorship information in their help center.

    • If you only made a single commit you should be able to run
      git commit --amend --author="Author Name <[email protected]>"
      
      (substituting Author Name and [email protected] for your actual information) to set the authorship information.
    • If you made more than one commit and the commit with the missing authorship information is not the most recent one you have two options:
      1. You can re-create all commits missing authorship information. This is going to be the easiest solution for developers that aren't extremely confident in their Git and command line skills.
      2. You can use this script that GitHub provides to rewrite history. Please note: this should be used only if you are very confident in your abilities and understand its impacts.
    • Whichever method you choose, I will come by to re-check the pull request once you push the fixes to this branch.

We apologize for this inconvenience, especially since it usually bites new contributors to Home Assistant. We hope you understand the need for us to protect ourselves and the great community we all have built legally. The best thing to come out of this is that you only need to fix this once and it benefits the entire Home Assistant and GitHub community.

Thanks, I look forward to checking this PR again soon! ❤️

@probot-home-assistant probot-home-assistant bot added integration: knx small-pr PRs with less than 30 lines. labels Feb 5, 2020
@probot-home-assistant
Copy link

Hey there @Julius2342, mind taking a look at this pull request as its been labeled with a integration (knx) you are listed as a codeowner for? Thanks!

@FredericMa
Copy link
Contributor Author

Sorry for the mess! First PR here... I'll clean this up this evening.

@MartinHjelmare MartinHjelmare changed the title Extend brightness with rgb brightness if brightness addresses are not supported. Extend knx brightness with rgb brightness if brightness addresses are not supported Feb 6, 2020
@codecov
Copy link

codecov bot commented Feb 9, 2020

Codecov Report

Merging #31496 into dev will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev   #31496      +/-   ##
==========================================
+ Coverage   94.62%   94.65%   +0.02%     
==========================================
  Files         750      756       +6     
  Lines       54314    54808     +494     
==========================================
+ Hits        51396    51877     +481     
- Misses       2918     2931      +13     
Impacted Files Coverage Δ
homeassistant/__init__.py 88.46% <0.00%> (-7.38%) ⬇️
homeassistant/components/hue/bridge.py 72.07% <0.00%> (-3.42%) ⬇️
homeassistant/components/unifi/controller.py 94.88% <0.00%> (-0.03%) ⬇️
homeassistant/helpers/debounce.py 94.87% <0.00%> (ø) ⬆️
homeassistant/components/hue/const.py 100.00% <0.00%> (ø) ⬆️
homeassistant/components/hue/sensor_base.py 96.22% <0.00%> (ø) ⬆️
homeassistant/components/samsungtv/const.py 100.00% <0.00%> (ø) ⬆️
homeassistant/helpers/update_coordinator.py 100.00% <0.00%> (ø) ⬆️
homeassistant/components/netatmo/config_flow.py 100.00% <0.00%> (ø) ⬆️
homeassistant/components/gdacs/config_flow.py 100.00% <0.00%> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 472fe7a...1515697. Read the comment docs.

@FredericMa
Copy link
Contributor Author

I need some advise on resolving the linting error below:
homeassistant/components/knx/light.py:186:25: E1136: Value 'self._hsv_color' is unsubscriptable (unsubscriptable-object)

I do a null check before getting the brightness so it will never crash...
Is there a way to solve this in code or can I just add # pylint: disable=unsubscriptable-object before that line?

@stale
Copy link

stale bot commented Mar 21, 2020

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@stale stale bot added the stale label Mar 21, 2020
@frenck
Copy link
Member

frenck commented Mar 21, 2020

It means you are trying to access an value as a list, while it isn't a list.

@stale stale bot removed the stale label Mar 21, 2020
@FredericMa
Copy link
Contributor Author

FredericMa commented Mar 21, 2020

Thanks for your reply.
Indeed, it is not a list. It is a tuple but nonetheless this looks like valid syntax to me.
Am I missing something? I did find two issues related to this in the pylint repo:
pylint-dev/pylint#3139
pylint-dev/pylint#2063
So to me it looks like a bug in pylint, no?

@frenck
Copy link
Member

frenck commented Mar 22, 2020

Aah yes, but that has been fixed some time ago. Please rebase your PR onto the latest dev branch to re-trigger the build with the latest greatest.

@FredericMa
Copy link
Contributor Author

/AzurePipelines run

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 31496 in repo home-assistant/core

@FredericMa
Copy link
Contributor Author

I already deleted the remote branch (stupid me) but it you can also trigger the build manually via comments but I don't have enough privileges to do so (see above).
Can you trigger it manually? Otherwise I'll need to recreate this pull request.

@frenck
Copy link
Member

frenck commented Mar 22, 2020

I'm happy to retrigger a run, but the PR needs to be rebased really...

@frenck
Copy link
Member

frenck commented Mar 22, 2020

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@FredericMa
Copy link
Contributor Author

Got it, I create PR #33152 for this.
Closing this one.
Build still seems to be failing though.

@FredericMa FredericMa closed this Mar 22, 2020
@lock lock bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed integration: knx small-pr PRs with less than 30 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants