Lumi.sensor_86sw1 blueprint

This blueprint assumes that the Aqara H1 is put into operation mode 1 and click mode 2.

See more information at [Device Support Request] Aqara H1 wireless switch double rocker (model WRS-R02) · Issue #940 · zigpy/zha-device-handlers · GitHub

blueprint:
name: ZHA - Aqara H1 (WRS-R02) Wireless Remote Switch (Double Rocker)
description: Automate your Xiaomi Aqara H1 (WRS-R02) Wireless Remote Switch (Double Rocker) using ZHA events.
domain: automation
input:
aqara_h1_switch:
name: Select the Aqara H1 (WRS-R02) Wireless Remote Switch (Double Rocker)
description: Aqara H1 (WRS-R02) Wireless Remote Switch (Double Rocker)
selector:
device:
integration: zha
manufacturer: LUMI
entity:
domain: sensor
device_class: battery

# Left button
button_single_press_left:
  name: Single Press Left
  description: Action to run on single press
  default: []
  selector:
    action:
button_double_press_left:
  name: Double Press Left
  description: Action to run on double press
  default: []
  selector:
    action:
button_triple_press_left:
  name: Triple Press Left
  description: Action to run on triple press
  default: []
  selector:
    action:
button_long_press_left:
  name: Long Press Left
  description: Action to run when button is long pressed (held down)
  default: []
  selector:
    action:

# Right button
button_single_press_right:
  name: Single Press Right
  description: Action to run on single press
  default: []
  selector:
    action:
button_double_press_right:
  name: Double Press Right
  description: Action to run on double press
  default: []
  selector:
    action:
button_triple_press_right:
  name: Triple Press Right
  description: Action to run on triple press
  default: []
  selector:
    action:
button_long_press_right:
  name: Long Press Right
  description: Action to run when button is long pressed (held down)
  default: []
  selector:
    action:

# Both buttons
button_single_press_both:
  name: Single Press Both Buttons
  description: Action to run on single presses
  default: []
  selector:
    action:
button_double_press_both:
  name: Double Press Both Buttons
  description: Action to run on double presses
  default: []
  selector:
    action:
button_triple_press_both:
  name: Triple Press Both
  description: Action to run on triple presses
  default: []
  selector:
    action:
button_long_press_both:
  name: Long Press Both Buttons
  description: Action to run when buttons are long pressed (held down)
  default: []
  selector:
    action:

mode: restart
max_exceeded: silent

trigger:

  • platform: event
    event_type: zha_event
    event_data:
    device_id: !input aqara_h1_switch

action:

  • variables:
    command: “{{ trigger.event.data.command }}”

  • choose:

    • conditions:

      • “{{ command == ‘1_single’ }}”
        sequence: !input button_single_press_left
    • conditions:

      • “{{ command == ‘1_double’ }}”
        sequence: !input button_double_press_left
    • conditions:

      • “{{ command == ‘1_triple’ }}”
        sequence: !input button_triple_press_left
    • conditions:

      • “{{ command == ‘1_hold’ }}”
        sequence: !input button_long_press_left
    • conditions:

      • “{{ command == ‘2_single’ }}”
        sequence: !input button_single_press_right
    • conditions:

      • “{{ command == ‘2_double’ }}”
        sequence: !input button_double_press_right
    • conditions:

      • “{{ command == ‘2_triple’ }}”
        sequence: !input button_triple_press_right
    • conditions:

      • “{{ command == ‘2_hold’ }}”
        sequence: !input button_long_press_right
    • conditions:

      • “{{ command == ‘3_single’ }}”
        sequence: !input button_single_press_both
    • conditions:

      • “{{ command == ‘3_double’ }}”
        sequence: !input button_double_press_both
    • conditions:

      • “{{ command == ‘3_triple’ }}”
        sequence: !input button_triple_press_both
    • conditions:

      • “{{ command == ‘3_hold’ }}”
        sequence: !input button_long_press_both
        Comment

This is not in a format that can be properly shared with others. Please either put this into a github gist, or format it as per the FAQ for this site:

How to help us help you - or How to ask a good question.

I also recommend adding your link to a ;my; link using this:

More suggestions from the HA Docs:
Creating an automation blueprint - Home Assistant.