i hope this is the correct section to ask this question:
I’ve got a few LED Lamps (flood lamp) which work with HUE but infact they are not from Philips.
Operating these lamps works quite well with HUE App.
I can select Colors and Brightness with no problems. Additionally these lamps got - beside colors - warm and cold white light.
In HUE App i can switch from Color-Picker to … lets call it White-Picker to choose warm and cold white colors. This picker has no colors like red, blue, green … but on the top warm white and on the bottom cold white colors.
I tried a few things with the HSB-Color-Spectrum but i cant find the correct values to send via OpenHAB to enable the “warm/cold white LEDs”.
As i am not sure if this is related to HSB-Spectrum or the LED-Floodlights, i maybe need a lead to the right place to find out
So is there maybe an option to read out the current HSB-Color after enabling manually (via HUE App) the desired color?
Just to tell you, this is what im sending right now and it is a kind of blue light with way less than 100% brightness. This stuff is inside a rule which is activated by the presence detector.
var DecimalType hue = new DecimalType(060)
var PercentType sat = new PercentType(000)
var PercentType bright = new PercentType(100)
var HSBType light = new HSBType(hue,sat,bright)
i_Test_2_Color.send(light)
I do that this way. I set up the lighting in the Philips Hue App and have a “save that to light-scene” switch that reads the numbers and stores them to proxy-items.
The other option would be not to use the color channel but the color_temperature while the color-channel is set to maximum (white).
Don’t have my coding here, but maybe that helps already…
There is a way to access the hue bridge api directly and read out all currently active parameters of connected lights and devices. Very good instructions can be found here: https://community.hom.ee/t/howto-hue-bridge-direkt-ueber-homee-steuern-ohne-ifttt/8748
Only in German, I‘m afraid, but guessing from your nick that shouldn‘t be a problem for you.
Thanks. It appears that i just have to send a value to the color-temp dimmer between 0 and 100 while 0 is cold-white and 100 is warm-white.
Problem is, that if i send any value there, the light is switching on. That means i have to first switch on with the HSB-Type which includes the brightness (100 to switch on with full power) and then the dimmer-value to choose color-temp.
If i like to switch off, i just send the HSB-Type with 0 brightness
Interesting issue: The hue lightstrip always lights a bit green when using white-colors (cold / warm). The “noname” Led floodlight doesnt do that
I actually like it this way, way easier to read the code in my opinion.
But to the original request:
my items:
String Bathroom_Lights_Scene "Lichtmodus im Badezimmer [%s]" (G_Bathroom_Lights)
// a save button to store the current setting:
Switch Bathroom_Lightmode_Save "Lichtmodus abspeichern" (G_Bathroom_Lightmodes) { expire="1s, state=OFF" }
// My actual light
Group G_Bathroom_CeilingLight "Deckenlampe"
Switch Bathroom_CeilingLight_Switch "Deckenlampe Schalter" <light> (G_Bathroom_LightsSwitches, G_Bathroom_CeilingLight) [ "Lighting" ] { channel="hue:0210:bridge:8:color" }
Dimmer Bathroom_CeilingLight_Dimmer "Dimmer von Deckenlampe " <light> (G_Bathroom_LightsDimmer, G_Bathroom_CeilingLight) [ "Lighting" ] { channel="hue:0210:bridge:8:color" }
Color Bathroom_CeilingLight_Color "Farbe von Deckenlampe " <light> (G_Bathroom_LightsColor, G_Bathroom_CeilingLight) [ "Lighting" ] { channel="hue:0210:bridge:8:color" }
Dimmer Bathroom_CeilingLight_Colortemp "Farbtemperatur von Deckenlampe " <light> (G_Bathroom_LightsColortemp, G_Bathroom_CeilingLight) [ "Lighting" ] { channel="hue:0210:bridge:8:color_temperature" }
//Dummy Items to store the scene-informatoin
Group G_Bathroom_Lightmode_Evening "Lightmodus 'Abend' im Badezimmer" (G_Bathroom_Lightmodes)
Switch Bathroom_Lightmode_Evening_CeilingLight_Switch "CeilingLight Schalter" (G_Bathroom_Lightmode_Evening)
Color Bathroom_Lightmode_Evening_CeilingLight_Color "CeilingLight Farbe" (G_Bathroom_Lightmode_Evening)
//another scene...
Group G_Bathroom_Lightmode_Night "Lightmodus 'Nacht' im Badezimmer" (G_Bathroom_Lightmodes)
Switch Bathroom_Lightmode_Night_CeilingLight_Switch "CeilingLight Schalter" (G_Bathroom_Lightmode_Night)
Color Bathroom_Lightmode_Night_CeilingLight_Color "CeilingLight Farbe" (G_Bathroom_Lightmode_Night)
and then I have a rule:
rule "Bathroom: save current Lights as Lightscene "
when
Item Bathroom_Lightmode_Save received command ON
then
logDebug("lightning.rules", "Bathroom: save current Lights as Lightscene " + receivedCommand)
switch(Bathroom_Lights_Scene.state){
case 'EVENING': {
Bathroom_Lightmode_Evening_CeilingLight_Switch.sendCommand(Bathroom_CeilingLight_Switch.state)
Bathroom_Lightmode_Evening_CeilingLight_Color.sendCommand(Bathroom_CeilingLight_Color.state)
}
case 'NIGHT': {
Bathroom_Lightmode_Night_CeilingLight_Switch.sendCommand(Bathroom_CeilingLight_Switch.state)
Bathroom_Lightmode_Night_CeilingLight_Color.sendCommand(Bathroom_CeilingLight_Color.state)
}
}
end
rule "Bathroom: Lightscene changes actual Lights"
when
Item Bathroom_Lights_Scene received command
then
logDebug("lightning.rules", "Bathroom: Lightscene changes actual Lights" + receivedCommand)
if (receivedCommand == 'AUTO'){
switch(Global_TimeOfDay.state){
case 'EVENING': Bathroom_Lights_Scene.sendCommand( 'EVENING' )
case 'NIGHT': Bathroom_Lights_Scene.sendCommand( 'NIGHT' )
}
return;
}
if (receivedCommand == 'ALL_OFF'){
G_Bathroom_LightsSwitches.sendCommand(OFF)
Bathroom_Lights_Timer.postUpdate(0)
return;
}
// ---- Scenes:
Bathroom_Lights_Timer.sendCommand( Bathroom_Settings_LightsOnMinimumTime.state ) //Set the Timer
switch (receivedCommand){
case 'EVENING': {
Bathroom_CeilingLight_Switch.sendCommand( Bathroom_Lightmode_Evening_CeilingLight_Switch.state )
Bathroom_CeilingLight_Color.sendCommand( Bathroom_Lightmode_Evening_CeilingLight_Color.state )
}
case 'NIGHT': {
Bathroom_CeilingLight_Switch.sendCommand( Bathroom_Lightmode_Night_CeilingLight_Switch.state )
Bathroom_CeilingLight_Color.sendCommand( Bathroom_Lightmode_Night_CeilingLight_Color.state )
}
default: {
logError("DUMP: Bathroom: Lightscene changes actual Lights", "unknown Light Scene:" + Bathroom_Lights_Scene.state.toString)
}
}
end
so if that Switch Bathroom_Lightmode_Save is pressed, it will read the values from the lamp and stores it in that proxy items.
and if I turn on the scene, it will use those values to command the lights.
Now when going through that script in detail, I think it would work just with the color item, deleting that switch item all together. Have no time to test that though.
Hi @papaPhiL, thanks so much for posting this, I love the idea! I have a question though, when I try to implement this, I get an error basically saying that Bathroom_Lights_Scene is not a defined item. I don’t see it defined anywhere in your items file, unless I am missing it? Thanks so much!
probably missed to put it in here, i just also checked this post and didnt find it
I dont know and i didnt test, but i guess this is maybe a text item, so its value can be “EVENING” or “NIGHT”
What i did in a similar case is that i defined a number item, where numbers represent the cases. Like
0 = nothing
1 = Do something i defined as Case 1
2 = Do something i defined as Case 2
100 = Confirmation, that rule was executed
So i guess this is also possible with a text item where you not compare for number but for Text like he did
String Bathroom_Lights_Scene "Lichtmodus im Badezimmer [%s]" (G_Bathroom_Lights)
I prefer to have meaningful values in items, there is no reason to have 0 (that actually means nothing) instead of “nothing” itself. Eventually, you get lost with your in-mind-mapping if you have lots of different numbers that mean different things depend on the context.
Interesting but for me this does not work. Maybe its related to the fact that i am not using HUE Lights (Floodlights) but even when storing the actual values - when restoring it takes different ones. Sometimes one of the bulbs has correct values, the other not.
This is really frustrating. I think it would be much easier to have some feature to create the correct values depending on the setpoint.
Like from Hex Color code (#RRGGBB) to this HSB stuff