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)
"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.

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"
}
