I’ve been working on getting an RGBW controller working, but i’m running into a bit of a headache situation.
first, a bit about this particular controller (Zooz Zen31). I suspect from my reading other controllers are similar.
It has 6 level “dimmer” switches. 3-6 are RGBW respectivly.
1 and 2 are control channels.
they are a little weird, in the fact that both work at the same time. You can set either to a non-zero value to turn the controller on (global brightness). you can also set either to 0 to turn the controller off.
Because of this behaviour, neither value can be used as a 100% certain on or off, as you can run into a situation where channel 1 is 0, channel 2 is 50, and the lights could be on or off, depending on which value was actually set last.
So try one… i ignored channel 1, just using channel 2, set the device to use “brightness” as the on off command, and that almost works well, except there is no dimmer memory, ON sets to 99 (highest value)
Try two. command topic set to channel 1, dimmer set to channel 2. works well in that the switch can remember it’s dimmer setting. but an On on channel one of a 99 value overrides the lower value on channel 2, and back to the same situation. (if i set on command type to dimmer, i cannot turn the switch on, as channel 1 stays at a 0 value).
Solution / Trying to do:
i would like to use channel 2 as a memory buffer / dimmer setting. so the dimmer value is always bound to channel 2, and channel 1 is just used for on / off control. but because of the way the switch works, the brightness is set to the last set value of either channel 1 or 2, so i have to set them both the same.
So; i would like the on_payload to set the value of channel 1 to the current value of channel 2
this is the relevant part of my broken config:
- platform: mqtt
name: Test RGB
command_topic: "homeassistant/11/38/1/0/set"
on_command_type: "last"
payload_on: "{{ '%i' | format( state_attr( 'light.rgb_rgb_dimmer_2' ,'brightness') * 99/255 )}}"
state_topic: "homeassistant/11/38/1/0"
state_value_template: "{{ 'OFF' if value_json.value == 0 else 'ON' }}"
brightness_state_topic: "homeassistant/11/38/2/0"
brightness_command_topic: "homeassistant/11/38/2/0/set"
brightness_value_template: "{{ value_json.value }}"
brightness_scale: 99
command topid is channel 1 (38/1)
brightness is set to channel 2 (38/2)
my payload_on command, which just evaluates to a number in the template checker, doesn’t appear to be doing anything. I know standard payload_on is just an ‘on’ so not sure how to set a value instead.