ZHA - Aqara Wireless Remote Switch (Single Rocker)

This blueprint will let you create automations for the Aqara Wireless Remote Switch (Single Rocker). It uses ZHA, and supports single, double and long presses.

Requirements:

  • Aqara Wireless Remote Switch (Single Rocker)
  • ZHA integration

The blueprint is based on ZHA - Aqara Wireless Remote Switch (Double Rocker) (credit to NachtaktiverHalbaffe) and ZHA - Aqara Wireless Mini Switch (credit to SeanM). As both of them point out in their blueprints, there are multiple versions of these switches, and some of them may not work. Please make sure to check out both of their posts to be sure you have all the information you need before you purchase one! I have a compatible switch (luckily), and I am using this blueprint on my current setup with no issues so far.

Blueprint:

blueprint:
  name: ZHA - Aqara Wireless Remote Switch (Single Rocker)
  description: Automate your Xiaomi Aqara Wireless Remote Switch (Single Rocker) using ZHA events.
  domain: automation
  input:
    aqara_mini_switch:
      name: Select the Aqara Wireless Remote Switch (Single Rocker)
      description: Aqara Wireless Remote Switch (Single Rocker)
      selector:
        device:
          integration: zha
          manufacturer: LUMI
          entity:
            domain: sensor
            device_class: battery
    button_single_press:
      name: Single Press
      description: Action to run on single press
      default: []
      selector:
        action:
    button_double_press:
      name: Double Press
      description: Action to run on double press
      default: []
      selector:
        action:
    button_long_press:
      name: Long Press
      description: Action to run when button is 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_mini_switch

action:
  - variables:
      command: "{{ trigger.event.data.command }}"

  - choose:
      - conditions:
          - "{{ command == 'single' }}"
        sequence: !input button_single_press
      - conditions:
          - "{{ command == 'double' }}"
        sequence: !input button_double_press
      - conditions:
          - "{{ command == 'long press' }}"
        sequence: !input button_long_press
9 Likes

Hi, I have an old Aqara Single Rocker (2016), the model is lumi.sensor_86sw1. Switch doesn’t support double or long press. But that’s ok, skip it :wink:
This switch successfully integrates with ZHA, however event data is different and blueprint doesn’t work for a single press.
I’ve modified this blueprint to work with the old version (part of the code with variables and conditions for single press action):

- variables:
    command: '{{ trigger.event.data.command }}'
    attribute_name:  '{{ trigger.event.data.args.attribute_name }}'
    attribute_value:  '{{ trigger.event.data.args.value }}'
- choose:
  - conditions:
    - condition: or
      conditions: 
        - '{{ command == ''single'' }}'
        - '{{ command == ''attribute_updated'' and attribute_name == ''on_off'' and attribute_value == ''Bool.true'' }}'
    sequence: !input 'button_single_press'

The event trigger is described here: ZHA Zigbee Tested Devices...Please add your device results - #646 by Quatuor

1 Like

Thanks mate, same here. Fits my needs perfectly . . . thanks for posting your modification

I have also an older version of Aqara Single Rocker, it is pairing with the Sonoff Zigbee 3.0 USB Dongle V2 (ZBDongle-E). I get the battery, temperature and identify, but when i press the button nothing happens.
Also no zha_event is triggered since i have listened for them.
Does some one knows how to solve it?

Hi @Axeriano

I’ve been using your modification for a long time for my WXKG03LM. It stopped working as of the newest 2023.8 release. Would you know what needs to be modified for it to work again?

Edit: to make it clear, the blueprint turns on the light(s) but never turn them off again.

Thanks!

@Carlos_Roldao,

Please try to use this blueprint. I have also for double rocker, just search in my repositories.

Let me know if it works, because I can’t test it, my switch was broken months ago. But double works just fine.

1 Like

Works for me

I want use only short_single_click for my lumi.sensor_86sw1. Basically it works but only for simple actions like light on/off.
Unfortunately i must use something more complicaated eg:

action: notify.mobile_app_honor_m6pro_arka
metadata: {}
data:
  data:
    image: /api/camera_proxy/camera.wejscie_high_resolution_channel
  message: Ktoś dzwoni do furtki {{now().strftime("%H:%M:%S")}}
  title: Dzwonek

Then automation based on this blueprint doesn’t work.

repeat:
  count: 5
  sequence:
    - sequence:
        - action: light.turn_on
          metadata: {}
          data:
            rgb_color:
              - 255
              - 0
              - 0
          target:
            entity_id:
              - light.gateway_light_34ce008d4fd0
              - light.gateway_light_7811dcb06922
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: 500
        - action: light.turn_off
          metadata: {}
          target:
            entity_id:
              - light.gateway_light_34ce008d4fd0
              - light.gateway_light_7811dcb06922
          data: {}
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: 500

More complicated automations like on example above does not work either. On “normal” automations without blueprint it works.