ZHA RGBGenie ZB-3008 and ZB-3009

This blueprint provides support for the RGBGenie ZB-3008 (black) - Tested and ZB-3009 (white) - Untested

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Naturally you can just bind this remote to the ZHA group you want to control, but if you have non-ZHA 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: ZHA - RGBGenie ZB-3008/3009
  description: |
    Control the RGBGenie ZB-3008/ZB-3009 remotes with ZHA.
    
    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 to use.  Pick either ZB-3008 (black) or ZB-3009 (white)'
      selector:
        device:
          integration: 'zha'
          manufacturer: 'RGBgenie'
    light_1:
      name: 'Light 1'
      description: 'The light(s) to control when button "1" pressed. Note the
        hardware ignores light number selections for the power button and will
        always use this light.'
      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.  Note that
        this entity is the only one affected by "Power" presses, so you might
        consider a group enity.'
      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_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: {}

mode: restart
max_exceeded: silent
variables:
  force_brightness: !input 'force_brightness'
  min_brightness: !input 'min_brightness'
  light_1: !input 'light_1'
  light_2: !input 'light_2'
  light_3: !input 'light_3'

trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_id: !input 'remote'

action:
  - variables:
      command: "{{ trigger.event.data.command }}"
      endpoint_id: "{{ trigger.event.data.endpoint_id }}"
      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:
      - 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
    - conditions:
      - '{{ command == "move_to_color" }}'
      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.event.data.args[0] / 65535) }}'
          - '{{ (trigger.event.data.args[1] / 65535) }}'
    - conditions: '{{ command == "move_with_on_off" }}'
      sequence:
      - repeat:
          count: 15
          sequence:
          - choose:
            - conditions:
              - condition: template
                value_template: '{{ trigger.event.data.params.move_mode == 1 }}'
              sequence:
              - service: light.turn_on
                data_template:
                  entity_id: '{{ light_entity }}'
                  brightness_step_pct: 10
                  transition: 1
            - conditions:
              - condition: template
                value_template: '{{ trigger.event.data.params.move_mode == 0 }}'
              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 == "move_hue" }}'
      sequence: !input 'button_play'
    - conditions: '{{ command == "move_to_color_temp" }}'
      sequence: !input 'button_white_short'
    - conditions: '{{ command == "stop_move_step" }}'
      sequence: !input 'button_white_long'

2 Likes

Thanks for the great blueprint! I have the ZB5028 which has 4 buttons and appears to behave slightly differently, I tweaked your blueprint and ended up with:

blueprint:
  name: ZHA - RGBGenie ZB-5008/ZB-5028
  description: |
    Control the RGBGenie ZB-5008/ZB-5028 remotes with ZHA.

    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.

    The "All On" Button always sends the last selected light number

  domain: automation
  input:
    remote:
      name: "Remote"
      description: "RGBgenie to use.  Pick ZB-5008/5028"
      selector:
        device:
          integration: "zha"
          manufacturer: "RGBgenie"
    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
    light_4:
      name: "Light 4"
      description: 'The light(s) to control when button "4" 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_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: {}

mode: restart
max_exceeded: silent
variables:
  force_brightness: !input "force_brightness"
  min_brightness: !input "min_brightness"
  light_1: !input "light_1"
  light_2: !input "light_2"
  light_3: !input "light_3"
  light_4: !input "light_4"

trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_id: !input "remote"

action:
  - variables:
      command: "{{ trigger.event.data.command }}"
      endpoint_id: "{{ trigger.event.data.endpoint_id }}"
      light_entity: |-
        {% if endpoint_id == 1 %}
          {{ light_1 }}
        {% elif endpoint_id == 2 %}
          {{ light_2 }}
        {% elif endpoint_id == 3 %}
          {{ light_3 }}
        {% elif endpoint_id == 4 %}
          {{ light_4 }}
        {% endif %}
  - choose:
      - conditions: '{{ command == "on" }}'
        sequence:
          - delay:
              hours: 0
              minutes: 0
              seconds: 0
              milliseconds: 100
          - choose:
              - conditions: "{{ force_brightness }}"
                sequence:
                  - service: light.turn_on
                    data_template:
                      entity_id: "{{ light_entity }}"
                      transition: 1
                      brightness_pct: !input "brightness"
            default:
              - service: light.turn_on
                data_template:
                  entity_id: "{{ light_entity }}"
                  transition: 1
      - conditions: '{{ command == "off" }}'
        sequence:
          - delay:
              hours: 0
              minutes: 0
              seconds: 0
              milliseconds: 100
          - service: light.turn_off
            data_template:
              entity_id: "{{ light_entity }}"
              transition: 1
      - conditions:
          - '{{ command == "move_to_color" }}'
        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.event.data.args[0] / 65535) }}"
                - "{{ (trigger.event.data.args[1] / 65535) }}"
      - conditions: '{{ command == "step_with_on_off" }}'
        sequence:
          - choose:
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.params.step_mode == 0 }}"
                sequence:
                  - service: light.turn_on
                    data_template:
                      entity_id: "{{ light_entity }}"
                      brightness_step_pct: 10
                      transition: 1
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.params.step_mode == 1 }}"
                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
      - conditions: '{{ command == "move_with_on_off" }}'
        sequence:
          - choose:
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.params.move_mode == 0 }}"
                sequence:
                  - service: light.turn_on
                    data_template:
                      entity_id: "{{ light_entity }}"
                      brightness_step_pct: 100
                      transition: 1
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.params.move_mode == 1 }}"
                sequence:
                  - service: light.turn_on
                    data_template:
                      entity_id: "{{ light_entity }}"
                      brightness_pct: "{{ min_brightness }}"
                      transition: 1
      - conditions: '{{ command == "move_hue" }}'
        sequence: !input "button_play"
      - conditions: '{{ command == "move_to_color_temp" }}'
        sequence: !input "button_white_short"
      - conditions: '{{ command == "stop_move_step" }}'
        sequence: !input "button_white_long"
1 Like

Cool! I’m glad it helped at least one person!

I saw you split toggle up into separate on/off events. Personally I found this a bit annoying because I have other devices/automations that may turn on/off the lights. The switch will try to turn on lights when you press Power, even if they’re already on, and vice versa. Meaning sometimes you have to press the power button twice for the desired effect. But that’s my use-case.

Anyways, again, I’m glad it was helpful. Thanks for your modifications, and hopefully it’s helpful to someone else with that device!