Blueprint for Xiaomi Wireless Remote Switch (WXKG01LM) via Xiaomi Gateway 3

I’m a beginner of HA, also the first time to sign in the community and create a topic here. I recently bought a new Mijia Wireless Remote Switch (WXKG01LM) and did not find that any automation blueprint for it, as I directly use Xiaomi Gateway 3 Integration to add it to HA, instead of ZHA or MQTT.

Therefore, considered it as a challenge, I managed to ‘created’ the version by referring the ZHA version created by carlosmesquita at this link.

Anyway, hope below helps. It’s appreciated if there is anything you could share in the comments section.

blueprint:
  name: Xiaomi Wireless Remote Switch (WXKG01LM) via Xiaomi Gateway 3
  description: Automate your Xiaomi Mijia Wireless Round Remote Switch.
  domain: automation

  input:
    mi_switch:
      name: Mijia Wireless Round Switch
      description: Mijia Wireless Round Switch to use
      selector:
        device:
          integration: xiaomi_gateway3
          manufacturer: Xiaomi
          model: lumi.sensor_switch WXKG01LM
    remote_button_single_press:
      name: Single Press
      description: Action to run on single press
      default: []
      selector:
        action: null
    remote_button_double_press:
      name: Double Press
      description: Action to run on double press
      default: []
      selector:
        action: null
    remote_button_triple_press:
      name: Triple Press
      description: Action to run on triple press
      default: []
      selector:
        action: null
    remote_button_quadruple_press:
      name: Quadruple Press
      description: Action to run on quadruple press
      default: []
      selector:
        action: null
    remote_button_multiple_press:
      name: Multiple Press
      description: Action to run on multiple press
      default: []
      selector:
        action: null
    remote_button_hold:
      name: Hold
      description: Action to run on hold
      default: []
      selector:
        action: null
    remote_button_release:
      name: Release
      description: Action to run on release
      default: []
      selector:
        action: null

trigger:
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: sensor.0x158d00073a6dba_action

action:
  - variables:
      action: "{{ trigger.event.data.new_state.state }}"
  - choose:
      - conditions: "{{ action == 'single' }}"
        sequence: !input "remote_button_single_press"
      - conditions: "{{ action == 'double' }}"
        sequence: !input "remote_button_double_press"
      - conditions: "{{ action == 'triple' }}"
        sequence: !input "remote_button_triple_press"
      - conditions: "{{ action == 'quadruple' }}"
        sequence: !input "remote_button_quadruple_press"
      - conditions: "{{ action == 'many' }}"
        sequence: !input "remote_button_multiple_press"
      - conditions: "{{ action == 'hold' }}"
        sequence: !input "remote_button_hold"
      - conditions: "{{ action == 'release' }}"
        sequence: !input "remote_button_release"

1 Like

Thanks a lot @Jake30b4d . Exactly what i was looking for. Using the Gateway 3 integration from alex with an WXKG01LM. Unfortunately the blueprint throws an error at me, not sure why:


Triggered manually at August 1, 2021, 10:18:34 PM
Define variables action
Stopped because an error was encountered at August 1, 2021, 10:18:34 PM (runtime: 0.01 seconds)

UndefinedError: 'dict object' has no attribute 'event'


d: '1627848615502'
alias: Xiaomi Wireless Remote Switch (WXKG01LM) via Xiaomi Gateway 3
description: ''
use_blueprint:
  path: homeassistant/button.yaml
  input:
    mi_switch: 0227c7XXX
    remote_button_single_press:
      - type: toggle
        device_id: e2e53ce9XXX
        entity_id: light.lightstrip_heizung
        domain: light

same problem here. automatisation does not work. I can select one of my buttons, setup 1 click action, but whene i click one time, the automatisation is not triggered. (last trigger=never) would be great to have this blueprint, because it needs about 3 single automatisations for one button instead.

thank you very much @Jake30b4d, but i got the same error as @jpdribbler. Have you updated your blueprint since then?