Calex Smart Wall Switch blueprint (not finished, need help!)

Hi guys, I recently bought a Calex Smart Wall Switch only to figure out this isn’t officially supported in ZHA.
However, it is in Z2MQTT: Calex 421782 control via MQTT | Zigbee2MQTT
Also see: Calex Dimmer Switch Colour Control (421782) Zigbee compatibility

ZHA does recognize the device so I thought I’d use the event listener to fetch the events myself and create a blueprint.

The on, off, and dim buttons are working fine and I even figured out the W button (switch color temperature to a random value).

The only issue I have is with the RGB. The switch fires a enhanced_move_to_hue_and_saturation event on cluster id 768 (whatever that means…) but there are no arguments passed that I can send to a sequence to set the color values or anything.
It almost seems like this device is just telling to “rotate through RGB values” or something, not sure…

It actually sends two events when trying to set a color:

First:

{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "00:15:8d:00:02:4f:3b:bb",
        "unique_id": "00:15:8d:00:02:4f:3b:bb:1:0x0300",
        "device_id": "cd4f7431b1eaeccd8ce5858ad65dfe45",
        "endpoint_id": 1,
        "cluster_id": 768,
        "command": "color_loop_set",
        "args": [
            15,
            0,
            0,
            0,
            0
        ]
    },
    "origin": "LOCAL",
    "time_fired": "2022-02-02T23:49:55.384259+00:00",
    "context": {
        "id": "341b419d520890bdf72020b8dd1e5e2f",
        "parent_id": null,
        "user_id": null
    }
}

Second:

{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "00:15:8d:00:02:4f:3b:bb",
        "unique_id": "00:15:8d:00:02:4f:3b:bb:1:0x0300",
        "device_id": "cd4f7431b1eaeccd8ce5858ad65dfe45",
        "endpoint_id": 1,
        "cluster_id": 768,
        "command": "enhanced_move_to_hue_and_saturation",
        "args": []
    },
    "origin": "LOCAL",
    "time_fired": "2022-02-02T23:49:55.521128+00:00",
    "context": {
        "id": "5a8fc04bddd5214fb8455b2762fe4f8f",
        "parent_id": null,
        "user_id": null
    }
}

If anyone has more info on how to proceed with this, please let me know!

blueprint:

  name: ZHA - CALEX - Smart remote - Custom Actions

  description: >-
    This automation simulates the use of the Calex Dimmer Switch Colour Control

  domain: automation

  input:
    remote:
      name: Calex remote control
      description: Select the remote control you wish to use.
      selector:
        device:
          integration: zha
#          manufacturer: Calex 
#          model: Smart Wall Switch 
    light:
      name: Light
      selector:
        target:
          entity:
            domain: light
#    dim_step:
#      name: Dim step
#      description: The dim amound in percentage
#      default: 10
#      selector:
#        number:
#          min: 0
#          max: 100
#          unit_of_measurement: percentage

mode: restart
max_exceeded: silent

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

action:
  - variables:
      command: "{{ trigger.event.data.command }}"
      cluster_id: "{{ trigger.event.data.cluster_id }}"
      endpoint_id: "{{ trigger.event.data.endpoint_id }}"
      args: "{{ trigger.event.data.args }}"
  - choose:
      # Short-Press on the ON button.
      - conditions:
          - "{{ command == 'on' }}"
        sequence:
          - service: light.turn_on
            target: !input light

      # Short-Press on the OFF button.
      - conditions:
          - "{{ command == 'off' }}"
        sequence:
          - service: light.turn_off
            target: !input light

      # Short-Press on the DIM UP button.
      - conditions:
          - "{{ command == 'step' }}"
          - "{{ args == [0, 42, 3] }}"
        sequence:
          - service: light.turn_on
            target: !input light
            data:
              brightness_step_pct: 10
#              transition: 1

      # Short-Press on the DIM DOWN button.
      - conditions:
          - "{{ command == 'step' }}"
          - "{{ args == [1, 42, 3] }}"
        sequence:
          - service: light.turn_on
            target: !input light
            data:
              brightness_step_pct: -10
#              transition: 1

      # Hold on the DIM UP button.
      - conditions:
          - "{{ command == 'move' }}"
          - "{{ args == [0, 100] }}"
        sequence:
          - repeat:
              count: 10
              sequence:
                - service: light.turn_on
                  target: !input light
                  data:
                    brightness_step_pct: 10
#                    transition: 1
                - delay: 0.5

      # Hold on the DIM DOWN button.
      - conditions:
          - "{{ command == 'move' }}"
          - "{{ args == [1, 100] }}"
        sequence:
          - repeat:
              count: 10
              sequence:
                - service: light.turn_on
                  target: !input light
                  data:
                    brightness_step_pct: -10
#                    transition: 1
                - delay: 0.5

      # Short-Press on the W button.
      - conditions:
          - "{{ command == 'move_to_color_temp' }}"
        sequence:
          - service: light.turn_on
            target: !input light
            data:
              color_temp: "{{ args.0 }}"
              transition: "{{ args.1 }}"


    default: []

Hi Jory, I have the same switch, so I would love to see a solution. As I am new to HA myself, I’m not familiar with the whole blueprint stuff. Have you made any progress?

Hi @jploonstra

I’ve just updates the blueprint with full HUE control.

1 Like

Hi Jory,

Thank you so much, works like a charm!

Just updated the GitHub link.
I missed a peace of dev code (notifications).
Please make sure you have the latest version!

Hi Jory,

I’m not using ZHA but Deconz. Do you think your blueprint will work with Deconz too?

I assume it would, you just need to change the device selector for the remote as these get filtered for ZHA devices.

Thanks, I’ll order one and see if I can get it to work.