-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[hue] Implement CLIP 2 / API v2 #13570
Conversation
Pinging @cweitkamp @kaikreuzer @lolodomo @jlaur => for your information :) |
@cweitkamp can you please help me fix the hue integration tests for this PR? The CLIP 2 bridge requires two additional OSGI bundles to support the SSE functionality -- namely |
Hm, it is not the implementation of the Reading Philips documentation it might be possible to change this because
I will look into that. |
One more question. Why do you think that the request with port are rejected? I am able to call either CLIP 2 API or the SSE when adding a port via linux console and curl commands. |
@cweitkamp apropos the SSE connection via HTTPS: Oops! I think I misled you concerning the certificate checker. It seems the issue was not due to the |
Color Temperature Channels: Fixed vs Relative ScaleAt some point, sooner or later, we will need to have a discussion about what is the correct scale to use for light's color temperature channel values.. It differs between API V1 and CLIP 2 as follows..
Obviously in the CLIP 2 binding we can code it either way. But we need to agree. => Any thoughts? EDIT: so if you have one room containing lights of different models with different actual mirek ranges, then on API V1 if you set all such lights to CT 50% you would observe the lights to have different actual color temperatures; whereas if you set them to 50% on CLIP 2 then all the lights should be observed to have the same actual color temperatures.. |
@ccutrer has just implemented 'mired' in openhab-core (mired, mirek or MK⁻¹ are the same). Perhaps we should use his implementation. |
Yes. That makes a lot of sense. :) But I feel less comfortable about @ccutrer 's 'scaled mired' (see below) on a scale {153 .. 370} which is in contrast to Philips Hue scale of {153 .. 500} on CLIP 2, or {model-dependent-minimum .. model-dependent-maximum} on API V1 .. ??
Note: in the existing Hue API V1 binding there are actually two channels -- namely a 'scaled mired' (where we "just" have a debate about the range of the scale) and colour temperature absolute (which is currently shown in Kelvin, but could easily be re-cast using UoM to mirek) |
^
|
Might I chip in? I agree that the espmilight scaled mireds isn't exactly a shining example. While I understand the simplicity of a 0-100% scale when someone isn't familiar with (or a device doesn't claim to have) a particular set of units, it seems to usually present more of a problem than not. A better example would be the HomeKit add-on: https://github.com/openhab/openhab-addons/pull/13538/files. It's flexible to work with however various bindings would implement it, but my "ideal" scenario would be a device that exposes a Number channel, with a stateDescription describing the minimum and maximum, and the binding supplying a QuantityType in its native units (probably mireds). This would allow HomeKit to construct the color temp most simply:
Exposing as a number also gives precise units (and now that core supports mireds, the user's preference - K or mireds) so that you can color-match multiple bulbs, regardless of their native range. It also makes it easy to display K (what's more natural to a common user who is familiar with 2700/3000/4000K bulbs), but do math with mireds (which is more appropriate for "make it a bit warmer"). You can still leave the Dimmer channel for the simple case, hiding the mired channel under "advanced" as has been discusses on the forum once. In that case, it's up for debate if the min/max should be what the binding supports (so at least it would be consistent among bulbs in the same binding), or what each individual bulb supports. |
On Hue the color temperature absolute channel is an advanced channel and currently has raw data in kelvin but I would change that to your mirek now. And probably the second percent channel should be in percent of the range of the actual lamp itself. |
Color temperature in Kelvin is something more natural and known by final users. Or mirek is maybe a common unit in US/UK ? |
I agree. Especially if you already have the channel in Kelvin, keep it in Kelvin. Just make sure to use a QuantityType when providing it, instead of a DecimalType, then conversions will "just work". And no, mired/mirek is not a common layman's unit in the US. It's more common when you start talking academic color theory because it's kind of like a logarithmic scale- 10 Mireds anywhere along the scale is the same amount of perceptible difference between colors. Whereas 5000K to 6000K is barely a difference, but 2700k to 3500k is significant. |
That is fine for my review comments. I just had a new look to OH-INF files and I have just a very minor comment for you @andrewfg : can you check the channel descriptions, you use sometimes "group of lights", sometimes "group of the lights". Please make this "consistent". My feeling is that "group of lights" is fine. |
...enhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/connection/Clip2Bridge.java
Outdated
Show resolved
Hide resolved
@fwolter : is there something still open for you ? |
I'm fine! |
@kaikreuzer @J-N-K : other involved people said they are finally ok with the unusual channels approach. If you are not ok, please tell us quickly ... before I merge this PR ;) PS: I also do not pronounce myself because I stopped following the discussion (after having initiated it) ;) |
@andrewfg : please consider my 2 last comments (even if they are minor) and then I merge your PR. |
Ok. I will do it this evening, when I get back home. |
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
Thank you @andrewfg |
🎉 🎉 🎉 |
* [hue] Implement CLIP 2 / API v2 --------- Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
…rature (openhab#3129) refs openhab/openhab-addons#13570 (comment) now that Kelvin and mireds/mireks are easily convertible Signed-off-by: Cody Cutrer <cody@cutrer.us> GitOrigin-RevId: 221c80b
* [hue] Implement CLIP 2 / API v2 --------- Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch> Signed-off-by: Matt Myers <mmyers75@icloud.com>
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/philips-hue-clip-2-api-v2-discussion-thread/142111/367 |
* [hue] Implement CLIP 2 / API v2 --------- Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch> Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
Resolves #13456
Description
This Pull Request adds support for the new Hue CLIP 2 API.
It comprises the following..
Note: the prior API v1 DTO classes were (sorry to say it) not well structured, and have also accumulated too much 'spaghetti code', so that it was impossible to directly map between API V1 and CLIP 2 things. So this is a 'breaking change' as far as migration of existing API V1 installations to CLIP 2. (This is presumably in line with why Philips Signify also chose to make a breaking change between API V1 and CLIP 2).
Nevertheless it includes all the code from API V1 so it is still backwards compatible for existing API V1 installations that will not be migrated.
Furthermore when new API v2 things are created via the discovery services, then if a legacy API v1 thing exists, the new v2 thing will attempt too clone the attributes of the existing v1 thing. And also, if a legacy API v1 thing exists and has items linked to its channels, then the new v2 thing will replicate the links between those items and the respective new v2 channels.
JAR Files for OH v4.0
You can install the binding from the Marketplace. The binding requires the UPnP transport feature which is sometimes not automatically installed, so you may need to execute the following command..
JAR Files for OH v3.4.x
You can install the binding from the Marketplace. In OH 3.4.x the binding requires the Jetty Http2 features which are not part of openHAB v3.4.x distribution, and the UPnP transport feature which is sometimes not automatically installed. So before installing please i) download the Jetty-Http2-Feature-Jars, ii) drop them in the
/addons
folder, iii) enter the following commands at the console command prompt, and restart your system.Migration
The Things in API v2 are created differently than in API v1; for testing purposes see the migration guide HERE.
Useful Links
The following are some useful resources..
Signed-off-by: Andrew Fiddian-Green software@whitebear.ch