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

Add support for percentage step size to fans #8393

Merged
merged 9 commits into from
Feb 22, 2021

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Feb 14, 2021

Proposed change

Add support for percentage step size to fans

yOrRMOWYmq

The pin value is now rounded to prevent floating points from showing up in the UI.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@bdraco bdraco marked this pull request as ready for review February 14, 2021 10:18
@spacegaier
Copy link
Member

Not having the pin feels a bit inconsistent since I think we have it in most (?) other sliders. Couldn't we just round the pin value?

@bdraco
Copy link
Member Author

bdraco commented Feb 14, 2021

Not having the pin feels a bit inconsistent since I think we have it in most (?) other sliders. Couldn't we just round the pin value?

Any idea how to do that? I couldn't find a way that worked with the underlying api

@Misiu
Copy link
Contributor

Misiu commented Feb 15, 2021

@spacegaier @bdraco maybe do it the other way:
Leave the step size=1, but change the slider max value. So if you have 7 speeds then you will move the value from 1 to 7.
This way the pin will show the speed as a number, but not as a percentage value (no need for rounding).

@bdraco
Copy link
Member Author

bdraco commented Feb 15, 2021

While I think that will solve the pin issue, we would still need to translate the speed number back into a percentage so we still get a float, but at least we could hide it.

If the fan doesn't have a fixed step (100 speeds) aka variable rate fan they would get 1-100 still.

The downside is we loose a bit of the abstraction.

@bdraco
Copy link
Member Author

bdraco commented Feb 18, 2021

I came up with a solution to avoid the need to hide the pin.

@bdraco bdraco merged commit ace7ee5 into home-assistant:dev Feb 22, 2021
@bdraco bdraco deleted the fan_step_size branch February 22, 2021 22:00
@github-actions github-actions bot locked and limited conversation to collaborators Feb 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants