Controlling Hue Bulbs (Colour and Brightness)

Tags: #<Tag:0x00007f6ce5fabe10> #<Tag:0x00007f6ce5fabcd0> #<Tag:0x00007f6ce5fabb90>

(Johnathan Barrett) #1

Hi, so I was able to add all my Philips bulbs into openHAB through Paper UI.

My problem is I’m able to turn my bulbs on and off from openHAB and Homekit but that’s all I can do. I can’t adjust the colour or brightness.

After I added the bulbs I created home.items file with the following content.

// Ground Floor

// Hall
Switch GF_Hall_Light "Light" <light> ["Lighting"]

// Living Room
//Switch GF_Living_Room_Light "Light" <outlet> ["Lighting"]


// First Floor

// Bedroom
Switch FF_Bedroom_ElectricBlanket "Electric Blanket" <outlet> ["Switchable"]
Switch FF_Bedroom_ElectricHeater "Electric Heater" <outlet> ["Switchable"]
Switch FF_Bedroom_Light "Light" <light> ["Lighting"]
Switch FF_Bedroom_Lamp "Lamp" <light> ["Lighting"]

// Master Bedroom
Switch FF_Master_Bedroom_Light "Light" <light> ["Lighting"]
Switch FF_Master_Bedroom_ElectricBlanket "Electric Blanket" <outlet> ["Switchable"]

// Landing
Switch FF_Landing_Light "Light" <light> ["Lighting"]


After doing this I also created a home.sitemap

sitemap home label="Home 🏡"
	Frame label="Hall"
		Switch item=GF_Hall_Light label="Light"

	Frame label="Master Bedroom"
		Switch item=FF_Master_Bedroom_ElectricBlanket label="Electric Blanket"
		Switch item=FF_Master_Bedroom_Light label="Light"

	Frame label="Bedroom"
		Switch item=FF_Bedroom_ElectricHeater label="Electric Heater"
		Switch item=FF_Bedroom_ElectricBlanket label="Electric Blanket"
		Switch item=FF_Bedroom_Light label="Light"
		Switch item=FF_Bedroom_Lamp label="Lamp"

	Frame label="Landing"
		Switch item=FF_Landing_Light label="Light"

So far everything is working as it should, I can control all my bulbs from Basic UI and from Homekit. What I’m struggling with is changing the brightness or colour of my bulbs. And when I say struggling I mean I can’t do it at all. I know I’m missing something but I can’t seem to work out what it is. Ideally what I’d like is for each bulb in Basic UI to have an On/Off Switch, Brightness slider and colour picker/sliders. And for the same thing to be reflected in Homekit.

Any help, pointers, advice, links to documentation I’m more than likely not finding?

(B K) #2

The following configuration works for me:

.items (replace channel configuration with your Hue bulb’s setting)

Color Light_FF_Living_Lamp		"Lamp [%d %%]"		<rgb>	(FF_Living, EveningLights, Lights) [ "Lighting" ]				{channel="hue:xxx:xxx:3:color"}

Nothing needed in the sitemap if you just add the items from the group, but if you want to call it out explicitly, you’ll need:

Switch item=Light_FF_Living_Lamp
Colorpicker item=Light_FF_Living_Lamp

The Switch item will handle a direct ON/OFF command, while the ColorPicker will present you with an HSV selector (the V will essentially be a dimmer slider to allow you to set brightness)

Also, here’s a rules entry, in case you ever need to control them automatically (I have a Hue light in the hallway leading to our master bath, which I turn on to a dark red color if my bedroom motion sensor detects movement (red doesn’t wake me up while providing visibility).

rule "Motion Events"
	Item Motion_MasterBedroom received update
	if (is_Night.state == ON && Motion_Master_Disable.state != ON) //is_Night is an Astro-set flag, makes the light only work at night; Motion_Master_Disable is an override switch in case I don't want motion events to turn light on
		if (Motion_MasterBedroom.state == 1)
			var DecimalType hue = new DecimalType(0) // 0-360; 0=red, 120=green, 240=blue, 360=red(again)
			var PercentType sat = new PercentType(100) // 0-100
			var PercentType bright = new PercentType(20) // 0-100
			var HSBType light = new HSBType(hue,sat,bright)