Adding support for Philips Hue White Ambiance

Moderator: leecollings

Post Reply
noppes123
Posts: 15
Joined: Sunday 23 April 2017 10:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Adding support for Philips Hue White Ambiance

Post by noppes123 »

I have been fiddling with Domoticz and other popular open source HA systems over the last few months and decided to go for Domoticz. Great stuff, BTW!
So, I started from scratch to build it out step by step. The first step was to get the readings from my P1 smart meter via the network. That works quite nice.

My second step is to get a grip on my Hue lights. I have "Dimmable Lights" type LBW010 for outdoors and "Color Temperature Lights" type LTW001 for indoors, but no 'RGBW' types. The support for the Color Temperature types in Domoticz seems limited and looking at the source code of the Hue driver I noticed it currently does not identify the Color Temperature types, since the Color Temperature is set by the 'ct' parameter and there is no check for that parameter. As a result these Philips Hue Ambiance White light bulbs are considered just 'Dimmable' (like the LBW010 type). This is the piece of code from GetLights where the type of light bulb is determined along with its key values:

Code: Select all

...
_eHueLightType LType = HLTYPE_NORMAL;
	
if (!light["state"]["bri"].empty())
{
	//Lamp with brightness control
	LType = HLTYPE_DIM;
	int tbri = light["state"]["bri"].asInt();
	if ((tbri != 0) && (tbri != 255))
		tbri += 1; //hue reports 255 as 254
	tlight.level = int((100.0f / 255.0f)*float(tbri));
}
if ((!light["state"]["sat"].empty()) && (!light["state"]["hue"].empty()))
{
	//Lamp with hue/sat control
	LType = HLTYPE_RGBW;
	tlight.sat = light["state"]["sat"].asInt();
	tlight.hue = light["state"]["hue"].asInt();
}
... here we should start checking for !light["state"]["ct'].empty() ... ;o)
The official API documentation is not very clear about the color temperature values, but this is stated fo the ct parameter(uint16):
"indicates the Mirek color temperature value a lamp shall be set to. The end value is also what shall be returned in the response. If a lamp is not capable to move to the target ct value then it shall still return success but with actual ct value achieved. If ct is incremented outside the capable range it shall remain on the limit value. (2012 connected lamps are capable of 153 (6500K) to 500 (2000K)."

I decided to look into it and take a shot at modifying the code to support the Color Temperature light bulbs. But before I can actually do that I need some pointers to get going, as I have no experience with Domoticz internal structure (I am reading the wiki and various forum posts, but no complete picture in my head, yet... :) ).

Two questions at this moment:
1) Can anyone tell me the info received from a GET '/api/<user>/lights/<number>' call for a RGBW light bulb? So I can make sure that it doesn't break when modifying the code (and do some testing with a dummy API).
2) Can someone point me to the right place to learn more about implementing the color temperature settings and controls (or at least the pieces of code)?
Obviously, if I can get it to work properly (may take a while as I have limited time available), I will submit the code for review and possible merge into the official branch. :lol:

BTW, this is the info received for a Color Temperature Light:

Code: Select all

{
	"state": {
		"on": false,
		"bri": 87,
		"ct": 406,
		"alert": "none",
		"colormode": "ct",
		"reachable": true
	},
	"type": "Color temperature light",
	"name": "Hoektafel Schemerlamp",
	"modelid": "LTW001",
	"manufacturername": "Philips",
	"uniqueid": "00:17:88:01:01:21:1e:0d-0b",
	"swversion": "5.50.1.19085"
}
Sorry for these questions, but I just started digging into it... ;)
noppes123
Posts: 15
Joined: Sunday 23 April 2017 10:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Adding support for Philips Hue White Ambiance

Post by noppes123 »

OK, I need some guidance/advice. While working on the type/data structures, I noticed the Philips Hue code uses two types of hardware to distinguish between the 'basic' on/off and dimmer lights and the RGBW types. The first category is defined as a pTypeLighting2 and the second category as pTypeLimitlessLights (primarily used for the LimitlessLED hardware).

Obviously, I don't want to break the code for LimitlessLED lights, so I was wondering how to add Philips Hue White Ambiance support for Color Temperature. Can I just add

Code: Select all

#define Limitless_ColorTemp 36
to the hardwaretypes.h list of LimitlessLED commands? Or should I expand on the pTypeLighting2 type? The latter seems to be used for HomeEasy, Kambrook and some other types of light bulbs.
Danny94
Posts: 7
Joined: Monday 18 January 2016 18:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Adding support for Philips Hue White Ambiance

Post by Danny94 »

The White Ambiance bulbs should really be supported!
I'm afraid i can't really help to get this done but would love to see it happen!
3x Hue Lux, 1x Hue Ambiance, 1x Hue rgbwstrip, 1x Hue Iris, 4x KiKa, KiKa doorbell
Raspberry Pi 3, RFXtrx433 USB
djac
Posts: 28
Joined: Tuesday 24 October 2017 9:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Adding support for Philips Hue White Ambiance

Post by djac »

Hi, I have been trying to get this to work as well and now I realize it's not supported, any news from anyone on this topic?
Domoticz on Rpi, Z-wave, Hue with Philips and Ikea bulbs
postgardh
Posts: 2
Joined: Wednesday 14 December 2016 13:44
Target OS: Linux
Domoticz version:
Contact:

Re: Adding support for Philips Hue White Ambiance

Post by postgardh »

Hi.

Does anyone have success to solve this problem.
Has the same problem.
My Philips Hue White Ambiance is RGBW light in domoticz.
And is only possible to turn On/Off and dimmer..

//
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest