I’ve got the first part working!
So here is the channel with the regex transformation
configuration: {}
bridgeUID: mqtt:broker:cf94322e0a
channels:
- id: LEDKochinselHSB
channelTypeUID: mqtt:color
label: LEDKochinselHSB
description: ""
configuration:
commandTopic: zigbee2mqtt/LEDKochinsel/set
colorMode: XYY
formatBeforePublish: "%s"
stateTopic: zigbee2mqtt/LEDKochinsel
transformationPattern: REGEX:s/\{"brightness":(.*?),"color":\{(?<=)"hue":(.*?),"saturation":(.*?)(?=),"x":(.*?),"y":(.*?)\},.*\}/$4,$5,$1/g
I did need to extend the regex but extract only brightness ($1) x($4) and y ($5).
Next I need to get the outgoing stuff working and add the brightness conversion … Man is that difficult to get this stuff working.
I will create an issue on the zigbee2mqtt git as I think they expose the wrong values or at least mix of xyY and HSB…
Update: DONE!
So here are the working channels:
channels:
- id: LEDKochinselXY
channelTypeUID: mqtt:color
label: LEDKochinselXY
description: null
configuration:
commandTopic: zigbee2mqtt/LEDKochinsel/set
colorMode: XYY
formatBeforePublish: '{"color":{"x":"%1$s","y":"%2$s"}}'
stateTopic: zigbee2mqtt/LEDKochinsel
transformationPattern: REGEX:s/\{"brightness":(.*?),"color":\{(?<=)"hue":(.*?),"saturation":(.*?)(?=),"x":(.*?),"y":(.*?)\},.*\}/$4,$5,$1/g
- id: LEDKochinselBrightness
channelTypeUID: mqtt:dimmer
label: LEDKochinselBrightness
description: ""
configuration:
commandTopic: zigbee2mqtt/LEDKochinsel/set
min: 0
formatBeforePublish: '{"brightness":"%s"}'
stateTopic: zigbee2mqtt/LEDKochinsel
transformationPattern: JSONPATH:$.brightness
max: 254
- id: LEDKochinselColorTemp
channelTypeUID: mqtt:dimmer
label: LEDKochinselColorTemp
description: null
configuration:
commandTopic: zigbee2mqtt/LEDKochinsel/set
min: 153
formatBeforePublish: '{"color_temp":"%s"}'
stateTopic: zigbee2mqtt/LEDKochinsel
transformationPattern: JSONPATH:$.color_temp
max: 500
Works for my liking. The only thing that is bothering me is that i cant get the brightness contol in the color picker working as it is a diffrent channel - but thats for future me i guess