So finally got things to work as I had hoped it would happen “out of the box” - Ha!
For others coming afterwards, the specific challenges I had included:
- realizing that not all required constants have been defined and that some values have to be set directly (e.g. the cluster and attribute Ids for “color temperature”;
- knowing I needed to add “setAttrFromValue” to allow write back to the device, and then knowing what values to set;
- getting the right combination of “minimum” and “maximum” values - which do not correspond to the documentation!
- knowing what value to set for “parseValueFromAttr” - again a bit hit and miss until things worked out.
In getting this to work, the most useful tools for debugging were:
- deCONZ Windows 10 application - that exposes all clusters & attributes and allows extensive testing;
- turning on all debugging in the zigbee adapter - and wading through the logs to find bits and pieces - I found it useful to reboot from time to time, if only to get my bearings in the log files;
- having a SAMBA share set up to R-Pi “gateway” folder - just to make it easier to access and update files;
- using Firefox debugging mode to examine the data sent to and from the browser app to the gateway - the JSON packages are exposed in the “request” and “response” data;
- Insomnia REST API app on Windows 10, to GET and PUT values to the device - test with a device that is working first to get the syntax correct, then try with your test device;
- patience, patience, and even more patience as, between each test, you have to remove the device, make your changes, disable & re-enable the zigbee adapter, the add the device again and see if it any better, then repeat many times.
I hope this will be useful to someone else. If anyone knows where all the attributes and other constants are documented, it would be very useful to indicate this and make a reference to it in the various files.
Here is the display with the “square” theme activated.
And here is the code I inserted in zb-xiaomi.js
'lumi.light.aqcn02': { // from deCONZ app
// ZNLPD12LM - Aqara LED dimmable light bulb
// www.zigbee2mqtt.io/devices/ZNLDP12LM.html
name: 'light',
description: 'Aqara LED light bulb',
'@type': ['Light'],
powerSource: zb_constants_1.POWERSOURCE.MAINS_SINGLE_PHASE,
activeEndpoints: {
1: {
profileId: zb_constants_1.PROFILE_ID.ZHA,
inputClusters: [
zb_constants_1.CLUSTER_ID.GENBASIC_HEX,
zb_constants_1.CLUSTER_ID.GENONOFF_HEX,
zb_constants_1.CLUSTER_ID.GENLEVELCTRL_HEX,
"0300", // Color control, from deCONZ app
],
outputClusters: [
],
},
},
properties: {
state: {
descr: {
'@type': 'OnOffProperty',
label: 'On/Off',
type: 'boolean',
},
profileId: zb_constants_1.PROFILE_ID.ZHA,
endpoint: 1,
clusterId: zb_constants_1.CLUSTER_ID.GENONOFF,
attr: 'onOff',
setAttrFromValue: 'setOnOffValue',
parseValueFromAttr: 'parseOnOffAttr',
},
level: {
descr: {
'@type': 'BrightnessProperty',
label: 'Brightness',
type: 'number',
minimum: 0,
maximum: 100,
},
profileId: zb_constants_1.PROFILE_ID.ZHA,
endpoint: 1,
clusterId: zb_constants_1.CLUSTER_ID.GENLEVELCTRL,
attr: 'currentLevel',
value: 0,
setAttrFromValue: 'setLevelValue',
parseValueFromAttr: 'parseLevelAttr',
},
color_temp: {
descr: {
'@type': 'ColorTemperatureProperty',
label: 'Color Temperature',
type: 'number',
minimum: 2200, // 454 mireds
maximum: 6500, // 153 mireds
},
profileId: zb_constants_1.PROFILE_ID.ZHA,
endpoint: 1,
clusterId: 0x0300, // from deCONZ app
attr: '',
attrId: 0x0007, // from deCONZ app
value: 0,
setAttrFromValue: 'setColorTemperatureValue', // guesswork
parseValueFromAttr: 'parseColorTemperatureAttr', // guesswork
},
},
},
enjoy!