Hi,
I added the Philips Hue binding to control my Hue lights.
Works perfectky if I add a brightness and colour item. Just set birghtness to 0 and the lights are off.
But now I want a switch in my sitemap to switch it on and off.
But preferably like a group header, so if I’d press the > next to the switch i get into a menu for brightness and colour.
Is that possible?
Thanks
fex
(Felix)
December 27, 2019, 9:42pm
2
Yes. I’m using the following setup - inspired by Smart Home mit openHAB 2 (German) :
Item-Example:
Group Hue_BR_Wardrobe
"Hue Kleiderschrank"
<light>
(Livingroom, Items)
Switch Hue_BR_Wardrobe_Switch
"Hue Kleiderschrank Schalter"
<light>
(Hue_BR_Wardrobe, GPower, GColor_Lights)
{ channel="hue:0210:xxxxxxxxxxxx:stripe3:color" }
Dimmer Hue_BR_Wardrobe_Brightness
"Hue Kleiderschrank Helligkeit [%d %%]"
<light>
(Hue_BR_Wardrobe)
{ channel="hue:0210:xxxxxxxxxxxx:stripe3:color" }
Color Hue_BR_Wardrobe_Color
"Hue Kleiderschrank Farbe"
<colorwheel>
(Hue_BR_Wardrobe, GColors)
[ "Lighting" ]
{ channel="hue:0210:xxxxxxxxxxxx:stripe3:color" }
Dimmer Hue_BR_Wardrobe_Temperature
"Hue Kleiderschrank Farbtemperatur [%d %%]"
<rgb>
(Hue_BR_Wardrobe)
{ channel="hue:0210:xxxxxxxxxxxx:stripe3:color_temperature" }
String Hue_BR_Wardrobe_Alert
"Hue Kleiderschrank Alarm"
<alarm>
(Hue_BR_Wardrobe)
{ channel="hue:0210:xxxxxxxxxxxx:stripe3:alert" }
Switch Hue_BR_Wardrobe_Effect
"Hue Kleiderschrank Effekt"
<party>
(Hue_BR_Wardrobe)
{ channel="hue:0210:xxxxxxxxxxxx:stripe3:effect" }
Sitemap-Example:
Switch item=Hue_BR_Wardrobe_Switch
label="Lampe Kleiderschrank"
mappings=[ON="Ein"]
visibility=[Hue_BR_Wardrobe_Switch != ON]
Text item=Hue_BR_Wardrobe_Switch
label="Lampe Kleiderschrank [MAP(lights.map):%s]"
valuecolor=[ON="green", OFF="maroon"]
visibility=[Hue_BR_Wardrobe_Switch == ON] {
Default item=Hue_BR_Wardrobe_Brightness
label="Helligkeit"
Default item=Hue_BR_Wardrobe_Temperature
label="Farbtemperatur"
Default item=Hue_BR_Wardrobe_Color
label="Farbton"
Switch item=Hue_BR_Wardrobe_Switch
label="Lichtband"
mappings=[OFF="Aus"]
Switch item=Hue_BR_Wardrobe_Alert
label="Alarm [MAP(lights.map):%s]"
mappings=[NONE="Aus", SELECT="Alarm", LSELECT="Langer Alarm"]
Selection item=Scene_Hue_Color_Bedroom
label="Farbszenen"
mappings=[
0="Rot",
120="Grün",
200="Türkis",
240="Blau",
270="Violett",
370="Warmes Licht"
]
} // END Text item=Hue_BR_Wardrobe_Switch
1 Like
Hey Felix,
Thanks a lot for the example. This works great for me!
Just one thing when I look at the logging. Inititially it threw a warning (all works like this):
[WARN ] [ui.internal.items.ItemUIRegistryImpl] - couldn’t transform value in label because transformationService of type ‘MAP’ is unavailable
After installing the Map transformation add-on it changed to an error (UI is remarkably slower):
[ERROR] [ui.internal.items.ItemUIRegistryImpl] - transformation throws exception [transformation=org.openhab.transform.map.internal.MapTransformationService@12cebdc, value=ON]
Any ideas on this?
in his code he is referencing “light.map’” the file actually containing the required transformations.
Do you have this lights.map file in place?
Br
Roel
fex
(Felix)
December 28, 2019, 10:46am
5
@Andy_Jansen I’m using a MAP transformation to transform the HUE states in labels into German - you could simply delete these tor use something like my lights.map file:
ON=ist an
OFF=ist aus
NONE=aus
SELECT=kurz
LSELECT=lang
-=undefiniert
Check, found it!
Made a new file (for Dutch language). All is working fine now.
Thanks!
1 Like