I have a paulmann Amaris Color Lamp that works with zigbee2mqtt. I want to control it with color x y and brightness. I made a mqtt thing, with a color channel xy.
That works fine, but I can not get the full brightness, because the lamp expects as max 254, and openhab send max 100.
Is it possible with JavaScript to calculate the string “x, y, brightness” from example “0.3,0.3,100” to “0.3,0.3, 254”.
I testet it only with the brightness on a extra dimmer channel, but don’t get it work with x y and brightness in one string.
Instead of using the formatBeforePublish, you can use a JavaScript outgoing transformation to both format the message and do the calculation for the brightness.
You could use zigbee2mqtt’s “experimental” feature “attribute_and_json”. Then send commands for colorXY and brightness in two separate channels. This allows to use a dimmer channel for brightness, where you can set minimum and maximum value.
This is how I configured my lamp (Aldi brand):
UID: mqtt:topic:mqtt_raspberry:ZigbeeRGBLight01
label: ZigbeeRGBLight01
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:systemBroker:mqtt_raspberry
location: Bedroom
channels:
- id: power
channelTypeUID: mqtt:switch
label: Power
description: ""
configuration:
commandTopic: zigbee2mqtt/ZigbeeRGBLight01/set
stateTopic: zigbee2mqtt/ZigbeeRGBLight01/state
off: OFF
on: ON
- id: dimmer
channelTypeUID: mqtt:dimmer
label: Brightness
description: ""
configuration:
commandTopic: zigbee2mqtt/ZigbeeRGBLight01/set/brightness
min: 0
stateTopic: zigbee2mqtt/ZigbeeRGBLight01/brightness
max: 254
- id: color
channelTypeUID: mqtt:color
label: Color
description: ""
configuration:
commandTopic: zigbee2mqtt/ZigbeeRGBLight01/set
colorMode: XYY
formatBeforePublish: '{"color":{"x": %1$s, "y": %2$s}}'
stateTopic: zigbee2mqtt/ZigbeeRGBLight01
(Note: removed some channels from the code for brevity)
Hi Jens,
thats very similar to the configuration that I use at the moment. I also made an extra channel for brightness, and one for rgb (also tested xy). But when I change the brightness in then Item there will be send two commands on mqtt (testet with mqttfx), each fo r one channel. and then tho colortemp changes a bit.
Have you linked all these channels with the same Item?
i have a solution for controlling brightness also, the only remaining problem is that brightness expects values from 0-254, but the slider in openhab only gives me 100 at max…
- id: color_xy
channelTypeUID: mqtt:color
label: color_xy
description: ""
configuration:
commandTopic: zigbee2mqtt/Hue white and color ambiance LightStrip plus/set
colorMode: XYY
formatBeforePublish: '{"color":{"x":"%s", "y":"%s"},"brightness":"%s"}'
stateTopic: zigbee2mqtt/Hue white and color ambiance LightStrip plus/
onBrightness: 20