ZHA - 1-Button (TS004F)

Hi everyone!

I just created my first blueprint for those very cheap single buttons identified as TS004F using the ZHA integration. Manufacturer is TZ3000_ja5osu5g and it is sold as eWeLink ZB-K1.

It supports:

  • Single press
  • Double press
  • Long press

It works by listening specifically to the press_type command sent by the device and filters out the extra noise from other events like toggle or remote_button_short_press.

Let me know what you think, and feel free to suggest improvements.

blueprint:
  name: ZHA - 1-Button (TS004F)
  description: |
    Handle single, double and long presses from 1-button devices identified as TS004F button using ZHA.

  domain: automation
  input:
    remote:
      name: TS004F 1-Button Device
      description: Select the TS004F 1-button
      selector:
        device:
          integration: zha
          model: TS004F

    single_press_action:
      name: Single Press
      description: Action to run on single press
      default: []
      selector:
        action: {}

    double_press_action:
      name: Double Press
      description: Action to run on double press
      default: []
      selector:
        action: {}

    long_press_action:
      name: Long Press
      description: Action to run on long press
      default: []
      selector:
        action: {}

mode: single

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

action:
  - variables:
      press_type: "{{ trigger.event.data.args[0] | int }}"

  - choose:
      - conditions:
          - condition: template
            value_template: "{{ press_type == 0 }}"
        sequence: !input single_press_action

      - conditions:
          - condition: template
            value_template: "{{ press_type == 1 }}"
        sequence: !input double_press_action

      - conditions:
          - condition: template
            value_template: "{{ press_type == 2 }}"
        sequence: !input long_press_action

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

1 Like