This is a Zigbee2MQTT version of this blueprint., I recently transitioned to Z2M, and needed this created.
This blueprint provides support for the RGBGenie ZB-3008 (black) - Tested and ZB-3009 (white) - Untested
Naturally you can just bind this remote to the Zigbee group you want to control, but if you have non-zigbee devices (EG: WiFi lights you’d like to control) this blueprint can aid.
All color buttons and color wheel buttons are supported and should behave as expected. This switch is very opinionated, color presets and playlists can’t be customized, this blueprint just passing the values straight through from the remote. I have added an option to add HASS steps to execute in addition to the color shifts. Useful if you need to switch off a circadian lighting service or something.
Brightness works, it alternates between going up and down with each long press.
Preset buttons (1, 2, 3) only change the device you’re controlling, but don’t trigger events. It’s worth noting the power button only sends to endpoint 3, so this is probably going to be a light group that controls the whole zone. Additionally, this remote sends separate “on” or “off” events but the blueprint treats both of these as “toggle” events. Helpful if you have multiple ways of turning on and off lights, then you don’t have to press power repeatedly to get the on/off event you desire.
The “Play” and “white” buttons are a little weird, I opted to just make these customizable. They send move_hue and move_to_color_temp events. I use these to set scenes, if you want to use the playlist built into the device some further dissection would be necessary.
blueprint:
name: Z2M - RGBGenie 3008
description: |
Control the RGBGenie ZB-3008/ZB-3009 remotes with Z2M.
The middle "on" button, toggle the lights on/off to the last set brightness
(unless the force brightness is toggled on in the blueprint).
Dim button will change the brightness smoothly when pressed
and held. Each press alternates between bright/dim. If Minimum Brightness
is set, dimming will stop at specified value, otherwise it will continue to
zero (off).
Color wheel selection and the three color presets will select colors. The
color wheels just below power cycle through some presets set in the device.
The white button's behavior is programmable (long vs short press). This is
intended to "Move Color Temp", but you can set your own behavior.
The "Play" button is also programmable, it is intended to "Move Hue"
The number buttons can't do anything, instead they are modifiers for the
next button pressed. So if you press "1" then "Red" it will set Light 1 to
red.
NOTE: the hardware ignores light number selections for the power button and
will always specify Light 3
domain: automation
input:
remote:
name: "Remote"
description: "RGBgenie action sensor to use. Pick either ZB-3008 (black) or ZB-3009 (white)"
selector:
entity:
domain: sensor
light_1:
name: "Light 1"
description: 'The light(s) to control when button "1" pressed.'
selector:
entity:
domain: light
light_2:
name: "Light 2"
description: 'The light(s) to control when button "2" pressed'
selector:
entity:
domain: light
light_3:
name: Light 3
description: 'The light(s) to control when button "3" pressed.'
selector:
entity:
domain: light
force_brightness:
name: "Force turn on brightness"
description: 'Force the brightness to the set level below, when the "on"
button on the remote is pushed and lights turn on.'
default: false
selector:
boolean:
brightness:
name: "Brightness"
description: "Brightness of the light(s) when turning on"
default: 50
selector:
number:
min: 0.0
max: 100.0
mode: slider
step: 1.0
unit_of_measurement: "%"
min_brightness:
name: "Minimum Brightness"
description:
"The minimum brightness of the light(s) when dimming down. Set
this to zero to disable this feature."
default: 1
selector:
number:
min: 0.0
max: 100.0
mode: slider
step: 1.0
unit_of_measurement: "%"
button_power:
name: "Power Button"
description: 'Action to run on short button press "power". Note this button is context unaware, so will always operate on light_3.'
default:
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
- choose:
- conditions: "{{ force_brightness }}"
sequence:
- service: light.toggle
data_template:
entity_id: "{{ light_entity }}"
transition: 1
brightness_pct: !input "brightness"
default:
- service: light.toggle
data_template:
entity_id: "{{ light_entity }}"
transition: 1
selector:
action: {}
button_white_short:
name: "White Button Short Press"
description: 'Action to run on short button press "white"'
default: []
selector:
action: {}
button_white_long:
name: "White Button Long Press"
description: 'Action to run on long button press "white"'
default: []
selector:
action: {}
button_play:
name: "Play Button Press"
description: 'Action to run on button press "play"'
default: []
selector:
action: {}
color_add_steps:
name: "Additional Color Steps"
description: "Additional action to run on color changes"
default: []
selector:
action: {}
source_url: https://community.home-assistant.io/t/z2m-rgbgenie-zb-3008-and-zb-3009/441117
mode: single
max_exceeded: silent
variables:
force_brightness: !input "force_brightness"
brightness: !input "brightness"
min_brightness: !input "min_brightness"
light_1: !input "light_1"
light_2: !input "light_2"
light_3: !input "light_3"
trigger:
- platform: state
entity_id: !input remote
from: null
not_to: ""
action:
- variables:
command: "{{ '_'.join(trigger.to_state.state.split('_')[:-1]) }}"
endpoint_id: "{{ trigger.to_state.state.split('_')[-1] }}"
light_entity: |-
{% if endpoint_id == 1 %}
{{ light_1 }}
{% elif endpoint_id == 2 %}
{{ light_2 }}
{% elif endpoint_id == 3 %}
{{ light_3 }}
{% endif %}
- choose:
- conditions: '{{ command == "on" or command == "off" }}'
sequence: !input "button_power"
- conditions:
- '{{ command == "color_move" }}'
sequence:
- if:
- condition: template
value_template: True
then: !input "color_add_steps"
- service: light.turn_on
data_template:
entity_id: "{{ light_entity }}"
xy_color:
- "{{ (trigger.to_state.attributes.action_color['x'] / 65535) }}"
- "{{ (trigger.to_state.attributes.action_color['y'] / 65535) }}"
- conditions: '{{ command in ["brightness_move_up", "brightness_move_down"] }}'
sequence:
- repeat:
count: 15
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ command == "brightness_move_up" }}'
sequence:
- service: light.turn_on
data_template:
entity_id: "{{ light_entity }}"
brightness_step_pct: 10
transition: 1
- conditions:
- condition: template
value_template: '{{ command == "brightness_move_up" }}'
sequence:
- if:
- condition: template
value_template: '{{ (((state_attr(light_entity, "brightness") | int(0) / 255) * 100) | int(0) - 10) >= min_brightness }}'
then:
- service: light.turn_on
data_template:
entity_id: "{{ light_entity }}"
transition: 1
brightness_step_pct: -10
else:
- service: light.turn_on
data_template:
entity_id: "{{ light_entity }}"
brightness_pct: "{{ min_brightness }}"
transition: 1
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- conditions: '{{ command == "hue_move" }}'
sequence: !input "button_play"
- conditions: '{{ command == "color_temperature_move" }}'
sequence: !input "button_white_short"
- conditions: '{{ command in ["color_stop", "color_temperature_move_up", "color_temperature_move_down"] }}'
sequence: !input "button_white_long"
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 50
trace:
stored_traces: 20