Automation for Zigbee eWeLink Button via ZHA

I recently purchased an inexpensive eWeLink Zigbee button off of AliExpress and integrated it using ZHA. Model: CK-TLSR8656-SS5-01(7000)
The button is great (especially considering the price), but you need to use zha_events for the automation, as it does not create a switch entity. I created a blueprint to make it easy to build simple automations with the button. I borrowed heavily from this blueprint from @ShogunMan, but made a few modifications to make it work with the eWeLink button.

blueprint:
  name: ZHA - 1-Button eWeLink Zigbee Button
  description: Automate a generic 1-button ZHA device using ZHA events.
  domain: automation
  input:
    zigbee_button:
      name: Zigbee Button
      description: The ZHA button device to use
      selector:
        device:
          integration: zha
          multiple: false
    button_single_press:
      name: Button, single press
      description: Action to run on button single press
      default: []
      selector:
        action: {}
    button_double_press:
      name: Button, double press
      description: Action to run on button double press
      default: []
      selector:
        action: {}
    button_long_press:
      name: Button, long press
      description: Action to run on button long press
      default: []
      selector:
        action: {}
mode: restart
max_exceeded: silent
trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_id: !input zigbee_button
action:
  - variables:
      command: "{{ trigger.event.data.command }}"
      endpoint_id: "{{ trigger.event.data.endpoint_id }}"
  - choose:
    - conditions: "{{ command == 'toggle' and endpoint_id == 1 }}"
      sequence: !input button_single_press
    - conditions: "{{ command == 'on' and endpoint_id == 1 }}"
      sequence: !input button_double_press
    - conditions: "{{ command == 'off' and endpoint_id == 1 }}"
      sequence: !input button_long_press
2 Likes

Works perfectly, thank you!