zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

[New device support]: Philips Hue gradient lightstrip

Open antsund opened this issue 4 years ago • 48 comments

Link

https://www.philips-hue.com/sv-se/p/hue-white-and-color-ambiance-ambiance-gradient-lightstrip-2-meter/8719514339965

Database entry

{"id":30,"type":"Router","ieeeAddr":"0x001788010b8f09ae","nwkAddr":2802,"manufId":4107,"manufName":"Signify Netherlands B.V.","powerSource":"Mains (single phase)","modelId":"LCX004","epList":[11,242],"endpoints":{"11":{"profId":260,"epId":11,"devId":269,"inClusterList":[0,3,4,5,6,8,4096,64515,768,64513],"outClusterList":[25],"clusters":{"genBasic":{"attributes":{"modelId":"LCX004","manufacturerName":"Signify Netherlands B.V.","powerSource":1,"zclVersion":2,"appVersion":2,"stackVersion":1,"hwVersion":1,"dateCode":"20210407","swBuildId":"1.86.6"}},"lightingColorCtrl":{"attributes":{"colorCapabilities":31,"colorTempPhysicalMin":153,"colorTempPhysicalMax":500,"colorMode":2,"currentX":29967,"currentY":26869,"enhancedCurrentHue":8417,"currentSaturation":140,"colorTemperature":366}},"genOnOff":{"attributes":{"onOff":1}},"genLevelCtrl":{"attributes":{"currentLevel":254}}},"binds":[],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":2,"stackVersion":1,"hwVersion":1,"dateCode":"20210407","swBuildId":"1.86.6","zclVersion":2,"interviewCompleted":true,"meta":{"configured":88764544},"lastSeen":1641732827294,"useImplicitCheckin":true}

Comments

Got it working using external converter. Added hueExtend but only including the needed parameters below. zigbeeModel and model are correct.

Picture: https://www.assets.signify.com/is/image/Signify/6d60ca09a85a44dc912cad24009a09b3?wid=1500&hei=1125&qlt=82

External converter

module.exports = [{
  zigbeeModel: ['LCX004'],
  model: '929002994901',
  vendor: 'Philips',
  description: 'Hue gradient lightstrip',
  meta: { turnsOffAtBrightness1: true },
  extend: hueExtend.light_onoff_brightness_colortemp_color({ colorTempRange: [153, 500] }),
  ota: ota.zigbeeOTA,
}];

Supported color modes

color temperature, color (rbg)

Color temperature range

{"colorTempPhysicalMin":153,"colorTempPhysicalMax":500}

antsund avatar Jan 09 '22 14:01 antsund

Btw there is no possibility to set multiple colors of the strip through z2m, right?

antsund avatar Jan 09 '22 16:01 antsund

Added.

Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)

Btw there is no possibility to set multiple colors of the strip through z2m, right?

Can this device display different colours in different segments of the strip?

Koenkk avatar Jan 09 '22 19:01 Koenkk

Can this device display different colours in different segments of the strip?

Yes it's a digital strip so each diode can display a color independent of the others. Think of it like ambilight. Here is a picture example:

https://www.assets.signify.com/is/image/Signify/0fc36f3f51c44a80b4caad2d00c8ae51?wid=960&hei=720&qlt=82

In the Hue app you can select three colors at the same time.

antsund avatar Jan 09 '22 19:01 antsund

@antonholmstedt I see, they probably use something custom from that, the Zigbee spec doesn't support such feature. You will have to sniff the traffic with the hue gateway to reverse engineer how this works. https://www.zigbee2mqtt.io/advanced/zigbee/04_sniff_zigbee_traffic.html#with-cc2531

Koenkk avatar Jan 09 '22 19:01 Koenkk

Thanks, will give it a try!

antsund avatar Jan 09 '22 19:01 antsund

@Koenkk I captured traffic from hue bridge to the gradient lightstrip while setting the colors for the zones. How can I transfer the pcap files and screenshots from the hue app to you?

oPixelHero avatar Jan 17 '22 23:01 oPixelHero

You can dump the pacpng files here, also share your network key.

Koenkk avatar Jan 18 '22 09:01 Koenkk

Network key: 51:D2:39:0B:60:1F:39:FB:3A:57:19:F2:6C:9D:4B:EA gradient_lightstrip_captures.zip

capture_1_hue_app

capture_2_hue_app

oPixelHero avatar Jan 18 '22 09:01 oPixelHero

@mluecke09 thanks, as can be seen in your sniff, the device uses a manufacturer specific command for this:

image

We can also send these commands from z2m, however someone has to reverse engineer the data payload (circled in red). Seems quite complex so not sure how to do that.

Koenkk avatar Jan 18 '22 16:01 Koenkk

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions avatar Feb 19 '22 00:02 github-actions

@mluecke09 thanks, as can be seen in your sniff, the device uses a manufacturer specific command for this:

image

We can also send these commands from z2m, however someone has to reverse engineer the data payload (circled in red). Seems quite complex so not sure how to do that.

I have a hue signe floor lamp with similar functionality. I have been able to sniff a lot of these packets while changing some variables individually.

@Koenkk Could you please point me in the right direction on how to send the manufacturer specific commands so that I can experiment?

tader avatar Jun 17 '22 15:06 tader

I added the command in the latest dev branch now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)

Update to the latest dev and load the following external converter:

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const e = exposes.presets;
const ea = exposes.access;

const tzLocal = {
    multicolor: {
        key: ['multicolor'],
        convertSet: async (entity, key, value, meta) => {
            const payload = {data: Buffer.from([0])}; // <-- take from right click on data -> copy hex value 
            await entity.command('manuSpecificPhilips2', 'multiColor', payload);
        },
    },
}

const definition = {
    zigbeeModel: ['TODO'], // <-- update this with the modelID from your data/database.db prob something similar to LCF003, 4080248P7 or 915005987201
    model: 'multicolortest',
    vendor: 'Philips',
    description: 'Hue Signe floor light',
    meta: {turnsOffAtBrightness1: true},
    extend: extend.light_onoff_brightness_colortemp_color({colorTempRange: [153, 500]}),
    toZigbee: [...extend.light_onoff_brightness_colortemp_color({colorTempRange: [153, 500]}).toZigbee],
    ota: ota.zigbeeOTA,
};

module.exports = definition;
  • save this as file next to configuration.yaml as ext_converter.js
  • add it to configuration.yaml:
external_converters:
  - ext_converter.js
  • I put two comments in the file, update them accordingly
  • start z2m
  • sending to zigbee2mqtt/MY_DEVICE_NAME/set payload {"multicolor": ""} will trigger the command

Koenkk avatar Jun 18 '22 08:06 Koenkk

@Koenkk awesome, thank you!!!

I changed ext_converter.js into the following so that I can just send data packets like {"multicolor": "500104001350000000d649510b5c4deb7c5d8b6d6d2b9b802800"} to zigbee2mqtt/MY_DEVICE_NAME/set.

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const e = exposes.presets;
const ea = exposes.access;
const Buffer = require('buffer').Buffer;



const tzLocal = {
    multicolor: {
        key: ['multicolor'],
        convertSet: async (entity, key, value, meta) => {
            const payload = {data: Buffer.from(value, 'hex')};
            await entity.command('manuSpecificPhilips2', 'multiColor', payload);
        },
    },
}

const definition = {
    zigbeeModel: ['4080248U9', '915005987201'],
    model: 'multicolortest',
    vendor: 'Philips',
    description: 'Hue Signe floor light multicolortest',
    meta: {turnsOffAtBrightness1: true},
    extend: extend.light_onoff_brightness_colortemp_color({colorTempRange: [153, 500]}),
    toZigbee: [tzLocal.multicolor, ...extend.light_onoff_brightness_colortemp_color({colorTempRange: [153, 500]}).toZigbee],
    ota: ota.zigbeeOTA,
};

module.exports = definition;

For now, I have only replayed some sniffed commands.

tader avatar Jun 18 '22 12:06 tader

@tader great to hear!

Koenkk avatar Jun 18 '22 13:06 Koenkk

Progress so far in deciphering the "multicolor" command on my Philips Hue Gradient Signe floor lamp.

The lamp itself seems to have 10 zones, in the command you can configure the color of 5 points on the lamp, these colors "bleed" into adjacent zones. Let's call the lamp zones 0-9 and the points which you can assign a color a-e.

      [0][1][2][3][4][5][6][7][8][9]
a     ===---...
b        ---===---...
c              ---======---
d                    ...---===---   
e                          ...---===


===: bleeds heavily into this zone
---: bleeds into this zone
...: bleeds a tiny bit into this zone

If you configure the entire lamp white and a single point blue, then the most bluest point is less blue than when you configure two adjacent points blue.

 0                               1
 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Prefix          | PtA | PtB | PtC | PtD | PtE | S |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Prefix (9 bytes): 500104001350000000

S(uffix) (2 bytes): 2800

Point (PtA - PtE) (5 points, 3 bytes each):

    0       1       2
+---.---+---.---+---.---+
| a | b | c | X | Y | d |
+---.---+---.---+---.---+

a (4 bits): Saturation? Brightness? b (4 bits): Tiny effect on Brightness??? c (4 bits): Tiny effect on Brightness??? X (4 bits), Y (4 bits): The x and y coordinates of a color (in CIE color space?) d (4 bits): Brightness? Saturation?

https://www.enigmaticdevices.com/philips-hue-lights-popular-xy-color-values/

A white point would therefore be: 000FFF, a warmer white point f00777, a blue point 0000100...

I quickly figured out the XY-color-coordinate bits for the various light points, but the other bits have me puzzled.

I have recorded 46 scenes from the Hue app, and made a script so that I could easily toggle any of these half-bytes to 0. For some of the scenes I toggled all half-bytes one by one. The half-bytes I named a and d sometimes seem to adjust brightness (in a seemingly random direction), other times they seem to adjust saturation. Those that I named b and c barely seem to change anything, these could be the least significant bits for a/d.

With XY-color-coordinates we wouldn't need a saturation value, probably it's just my eyes playing ticks on me... So, maybe it's just 3 bytes (X, Y, brightness) that they shuffled around to confuse someone reverse-engineering the command...

tader avatar Jun 20 '22 10:06 tader

Wow. This looks like real brain work to figure this out. It would be really great if we could see this feature for the gradient devices (mine is a signe table lamp) in the future. Thanks for all your efforts.

classicsdriver avatar Aug 06 '22 18:08 classicsdriver

So, I have made no progress in reverse engineering the gradient commands other than as described in my comment above.

On https://developers.meethue.com I did use the contact form to ask for documentation on the command, but I never received a response.

I did however capture all gradient scenes in the Hue app, these are sufficient for my personal use. I could provide a list of those to be used with the multicolor command. However, these gradients are probably under copyright by Signify/Philips.

@Koenkk do you have an idea on how to continue?

tader avatar Aug 08 '22 13:08 tader

@tader what about adding support for all the gradient scenes? This would be a good first step IMO. Reverse engineering these messages tends to be very hard 😄

Koenkk avatar Aug 08 '22 15:08 Koenkk

@Koenkk my ext_converter.js with all gradients from the Hue scenes

I should probably

  • make you a real PR,
  • extract the scenes in a separeate JSON file.

For now, the information is at least shared... I'm also still a bit worried about copyright issues.

tader avatar Aug 15 '22 10:08 tader

@tader

Thanks for the converter, code looks good, if you want I can also integrate it.

I'm also still a bit worried about copyright issues.

I'm not really worried tbh. The only thing that has been copied are the names, it doesn't contain the x/y or rgb codes of the colors (technically yes of course, but nobody can reverse engineer them from the payloads).

Koenkk avatar Aug 16 '22 15:08 Koenkk