This blueprint exposes WXKG12LM
actions via a device trigger, required in the upcoming Zigbee2MQTT 2.0 release.
Edit: This was reverted in fix(ignore): Add back Home Assistant legacy action sensor by Koenkk · Pull Request #25192 · Koenkk/zigbee2mqtt · GitHub and the sensor entities have been restored. Of course, this blueprint still works, but users upgrading to the 2.0 release when it’s out won’t have any breaking automations to fix up.
This is nearly identical to Aqara Wireless Switch WXKG11LM (via Zigbee2MQTT device trigger), but a separate blueprint because the newer switch does not support triple and quadruple clicks in favour of a gyroscope.
blueprint:
name: Aqara Wireless Switch WXKG12LM (via Zigbee2MQTT device trigger)
description: Control anything using Aqara Wireless Switch
domain: automation
input:
device:
name: Switch
description: Aqara Wireless Switch to use
selector:
device:
filter:
- manufacturer: Aqara
model: Wireless mini switch (with gyroscope) (WXKG12LM)
multiple: false
press_single:
name: Single button press
description: Action to run on single button press
default: []
selector:
action: {}
press_double:
name: Double button press
description: Action to run on double button press
default: []
selector:
action: {}
press_hold:
name: Hold button press
description: Action to run on button hold
default: []
selector:
action: {}
press_release:
name: Release button
description: Action to run when button is released
default: []
selector:
action: {}
press_shake:
name: Shake switch
description: Action to run on shaking the switch
default: []
selector:
action: {}
source_url: https://community.home-assistant.io/t/aqara-wireless-switch-wxkg11lm-via-zigbee2mqtt-device-trigger/808126
mode: queued
max_exceeded: silent
trigger:
- platform: device
domain: mqtt
device_id: !input device
type: action
subtype: single
- platform: device
domain: mqtt
device_id: !input device
type: action
subtype: double
- platform: device
domain: mqtt
device_id: !input device
type: action
subtype: hold
- platform: device
domain: mqtt
device_id: !input device
type: action
subtype: release
- platform: device
domain: mqtt
device_id: !input device
type: action
subtype: shake
action:
- choose:
- conditions: "{{ trigger.payload == 'single' }}"
sequence: !input press_single
- conditions: "{{ trigger.payload == 'double' }}"
sequence: !input press_double
- conditions: "{{ trigger.payload == 'hold' }}"
sequence: !input press_hold
- conditions: "{{ trigger.payload == 'release' }}"
sequence: !input press_release
- conditions: "{{ trigger.payload == 'shake' }}"
sequence: !input press_shake