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

oh-knob & oh-stepper: Add offset functionality #1875

Merged
merged 4 commits into from
May 7, 2023

Conversation

florian-h05
Copy link
Contributor

Supersedes #1565.

This adds an offset parameter to the knob and stepper components, that allows to add or subtract a number value to the displayed state of the component.

This is useful for thermostats which have a fixed temperature of n and are controlled with an offset to that temperature n, e.g. you have a KNX HVAC system which has a fixed temperature of 20 °C: -2 would mean the target temperature is 18 °C, +2 would mean that the target temperature is 22 °C. By setting the offset parameter to 20, the UI will display the real target temperature instead of the -2 or 2.

The styling is required to fix a style issue.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Supersedes openhab#1565.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
@florian-h05 florian-h05 requested a review from a team as a code owner May 6, 2023 21:12
@florian-h05
Copy link
Contributor Author

@ghys While implementing this, I noticed that the setpoint has an input field, which however does not work when setting min/max values (e.g. min is 14, max is 26: you want to input 22, but the moment you remove the second digit the value will become 14).
I then decided to completely disable the input, WDYT of that decision?

@relativeci
Copy link

relativeci bot commented May 6, 2023

Job #968: Bundle Size — 15.75MiB (~+0.01%).

58dbbc9(current) vs a0dfd36 main#967(baseline)

⚠️ Bundle contains 16 duplicate packages

Metrics (3 changes)
                 Current
Job #968
     Baseline
Job #967
Initial JS 1.73MiB(+0.04%) 1.73MiB
Initial CSS 608.87KiB(~+0.01%) 608.85KiB
Cache Invalidation 93.95% 93.95%
Chunks 219 219
Assets 689 689
Modules 1718(+0.06%) 1717
Duplicate Modules 85 85
Duplicate Code 1.73% 1.73%
Packages 137 137
Duplicate Packages 15 15
Total size by type (3 changes)
                 Current
Job #968
     Baseline
Job #967
CSS 858.61KiB (~+0.01%) 858.58KiB
Fonts 526.1KiB 526.1KiB
HTML 1.23KiB 1.23KiB
IMG 140.74KiB 140.74KiB
JS 9.25MiB (~+0.01%) 9.24MiB
Media 295.6KiB 295.6KiB
Other 4.73MiB (~-0.01%) 4.73MiB

View job #968 reportView main branch activity

@ghys
Copy link
Member

ghys commented May 7, 2023

I then decided to completely disable the input, WDYT of that decision?

Maybe it could upset some users who liked the feature for items which don't have min/max constraints. I'd say maybe make it optional, opt-in by default, but it's probably better to still have the option.

@florian-h05
Copy link
Contributor Author

Okay, thanks for the feedback. I will let you know when I'm finished 👍

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
@florian-h05
Copy link
Contributor Author

@ghys Done!

Copy link
Member

@ghys ghys left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM!

@ghys ghys added enhancement New feature or request main ui Main UI labels May 7, 2023
@ghys ghys added this to the 4.0 milestone May 7, 2023
@ghys ghys merged commit 52da897 into openhab:main May 7, 2023
@florian-h05 florian-h05 deleted the offset-for-ui-widgets branch May 7, 2023 12:21
florian-h05 added a commit to florian-h05/openhab-webui that referenced this pull request May 13, 2023
Regression from openhab#1875.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
ghys pushed a commit that referenced this pull request May 19, 2023
Regression from #1875.

--
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
florian-h05 pushed a commit that referenced this pull request Sep 25, 2023
Fixes #2089.
Possibly regression from #1875.

Stepper formatValue was calculating displayed number of decimals from the value of the step property, not it's length.

Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
florian-h05 pushed a commit that referenced this pull request Sep 25, 2023
Fixes #2089.
Possibly regression from #1875.

Stepper formatValue was calculating displayed number of decimals from the value of the step property, not it's length.

Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
(cherry picked from commit 0cc4f27)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request main ui Main UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants