-
-
Notifications
You must be signed in to change notification settings - Fork 428
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
[Sitemap] Widget for color temperature #3891
Comments
For a color item, we have already the colorpicker widget to select the color, the slider widget to select its brightness and the switch widget to turn it on or off. For color temperature, we could imagine either a new widget or an option to the existing colorpicker widget. In both cases, we need to implement a new UI in all apps. It could be a simple slider ? As a min and max values are probably required, a new widget similar to slider widget would be better I believe. We could name it colortemperature. |
To be thought how an UI can then build the command to be sent to the server. |
The colorpicker can also control the brightness, which is very nice. When making the color temperature a new option for the colorpicker, we solve two issues:
|
Color temperature channels are either Dimmers or Numbers though, not Colors, so I don't think that idea will fly. For controlling color temperature channels, the client would need to differentiate between dimmer (relative) or absolute channels (by item type):
|
Ok, so then it's required to add two items to one widget, like |
We have two system channel types for color temperature. The first expects a Dimmer item: Line 233 in 6d0a3b3
The second expects a Number:Temperature item: Line 244 in 6d0a3b3
For both of them, it looks natural to use a Slider widget. But I agree that for the second we could imagine a new dedicated widget showing the rendering of white, I imagine it as a slider + an image showing a gradient of temperatures but each app could implement it as it prefers. The idea would be to handle a kelvin (or mireds) value. |
For this new sitemap element, I imagine in Basic UI the same rendering as for a Slider element but with an additional button allowing to open a popup to pick a color temperature. |
In OH core ColorUtil we have public methods for converting everything to everything, and back. For your specific case of Kelvin to RGB one would use |
PS apropos this issue in general: As the OP has remarked, most light bindings have two ways of setting the Color Temperature -- namely
It is important to note that in the latter case the respective 0% and 100% points relate to the minimum and maximum Mirek capabilities of the actual lamp being controlled. So, in other words, if you have two lamps from different manufacturers with different colour temperature capabilities, then any particular slider position (say 42%) could relate to a totally different colour temperature. Therefore for the purposes of this PR I would strongly suggest to focus only on a UI element that produces an absolute QuantityType:Temperature value. i.e. forget about the 0..100% slider stuff.. |
Yes, that is also my idea. I prefer a separate widget that could also be considered when Default widget is set and the item is of type Number with temperature dimension and has colorTemperature tag. I would name it Colortemperaturepicker. @mueller-ma : is it also ok for you? I can implement the core part quickly, it is only few new lines of code. |
Reading the first messages, I realize that this will provide only color temperature control, not brightness control in the same widget. |
But having two widgets, one for brightness and one for colour temperature is acceptable I believe. |
The issue is mostly above having one widget for brightness and temperature. As I suggested in my first post, the color picker could be limited to temperatures of white. |
@lolodomo also when you implement something, please remember that the widget output QuantityType:Temperature should NOT produce a linear output in Kelvin. This is because the human eye does not perceive a linear Kelvin transition as a linear visual transition. That is the reason why the inverse Kelvin Mirek unit was invented. The human eye DOES perceive a linear Mirek transition as a linear visual effect. |
I understand that my proposal does not respond to your need! |
If this is better, we can consider mired instead of Kelvin. |
So that's fine to have different widgets? |
I don't see how that would work (in terms of syntax) though. A color picker for color and brightness needs only one item (as brightness is part of color), a color picker for color temperature would need two items (color temperature and brightness). How should core and/or main UI validate that properly? |
The hue example shows clearly different "widgets", we could have the same approach in openHAB. We already have these existing widgets:
My proposal is to add a fourth widget for colour temperature (but not combined with brightness).. |
You must definitely do this. It must produce QuantityType:Temperature where the linear transition from one end of the widget control to the other produces a linear output in Mirek. Typically the lowest Mirek is 153 (aka 6500 Kelvin) and the highest Mirek is 500 (aka 2000 Kelvin)
Makes sense. |
@andrewfg : I will have more difficulty to find an image with a gradient in mired instead of Kelvin. |
Umm. That is not really a reason to do it wrong. And you could use the gradient that the OP copied from Hue above. IMHO the Hue engineers do really have a solid understanding. |
I found this one but the values looks wrong, like negative. |
^ PS you also need to decide the min/max range of the scale. It seems that max Mirek 500 (2000 K) is fairly non controversial. And in OH bindings (resp. actual lamps) min Mirek 153 (6500 K) is common. But others seem to prefer min Mirek 100 (10000 K). The latter would perhaps be more future proof for future much bluer lamps, but would overflow for lamps like Hue or Zigbee ones. |
Agreed. ): |
I will create some gradients tomorrow. What image format do you prefer (e.g. png etc.) and what width (in pixels)? Note pixel height is trivial since each row is the same.. |
Looking at the current color picker in Basic UI, I see the gradient for brightness dynamically adjusted with the selected colour. I assume it is computed, I have to check how. Maybe I could replace it with a computed gradient of mired values. If not possible, we could have an image with a linear gradient between 100 and 500 mired. Same width as the colorwheel in the colour picker (to be checked). Colorwheel image is in PNG format so let's go with same format. I will reject selection of temperature outside the min/max of the current light. If the user clicks < min in the image, I will adjust to min. Similar for max. But if I could build dynamically the gradient, that would be even better. |
Related to openhab/openhab-core#3891 Signed-off-by: Laurent Garnier <[email protected]>
Related to openhab/openhab-core#3891 Signed-off-by: Laurent Garnier <[email protected]>
Related to openhab/openhab-core#3891 Signed-off-by: Laurent Garnier <[email protected]>
Feature is now implemented in Basic UI and will be available in 4.3 M3. |
@lolodomo gentle reminder to add this (doc) to 4.3 RC .. and also add to the 'What's new in 4.3' announcement.. |
@maniac103 Can you share the code from your prototype for the Android app? A draft PR would be fine for me, so I can have a look at it and maybe finish the new slider. |
Sure: openhab/openhab-android#3830 I think it should work, but it's completely untested at the moment. |
Also include a small change of the Colorpicker element. Related to openhab/openhab-core#3891 Related to openhab/openhab-webui#2873 Signed-off-by: Laurent Garnier <[email protected]>
* [sitemap] New Colortemperaturepicker element Also include a small change of the Colorpicker element. Related to openhab/openhab-core#3891 Related to openhab/openhab-webui#2873 Signed-off-by: Laurent Garnier <[email protected]> * Review comments Signed-off-by: Laurent Garnier <[email protected]> --------- Signed-off-by: Laurent Garnier <[email protected]>
Closes #2852. Refs openhab/openhab-core#4420. Related to openhab/openhab-core#3891. This implements configuring a color temperature picker in the sitemap builder UI. It also does some visualisation improvements of names and labels (by defaults shows item label in treeview, analogous to model treeview). --------- Also-by: Florian Hotze <[email protected]> Signed-off-by: Mark Herwege <[email protected]>
I just merged the Main UI PR 👍 |
Documentation was also updated (merged). |
Implementation for Android also is 90% done. I just need to do some final cleanup there. |
I discovered a case where determining of unit of min/max in state description does not work ! I believe we really need the |
Until we have the |
Is this an actual issue (IOW, are there bindings that use Mirek) or (at least currently) an academic one? |
There is at least one binding that uses mirek. However we have a work around for it for the state description for purposes of interpreting min/max -- albeit not for purposes of UI |
Mirek is used in one binding (don't remember which one) of our distribution + the new matter binding. |
PR openhab/openhab-webui#2894 is fixing unit determination from state description. |
It is now also implemented in Android app. I believe we can close this feature without waiting for an implementation in iOS app. |
Is there a issue in the iOS repo that you can link? |
There is no issue but I guess this is not yet implemented. I have not checked. |
Is your feature request related to a problem? Please describe.
For some time I created two sliders for lightbulbs that can change their color temperature. One for brightness, one for color temperature.
Recently I acquired a Nanoleaf Elements light (LEDs with brightness and color temperature settings). The binding allows to use a color picker to control both brightness and color temperature settings. All colors expect in the range cold white to warm white are ignored by the binding, but I can control both with just one widget.
Describe the solution you'd like
Add a new option to the
Color
widget (e.g.temperatureOnly
) that limits the color selection from cold white to warm white.Example from the Ikea Tradfri app:
Describe alternatives you've considered
Additional context
Coordination between maintainers
Notify maintainers of other UIs:
@openhab/webui-maintainers
@openhab/android-maintainers
@openhab/ios-maintainers
Checklist for implementation:
The text was updated successfully, but these errors were encountered: