ZigBee2Mqtt - Xiaomi WXKG12LM Wireless Switch

Blueprint to support the Aqara Wireless Mini Switch with Gyroscope with ZigBee2Mqtt integration.
(Based on the work of Drafted)

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

blueprint:
  name: ZigBee2Mqtt - Xiaomi WXKG12LM Wireless Switch
  description: Control anything using Xiaomi WXKG12LM (single button) remote
  domain: automation
  input:
    action_sensor:
      name: Remote
      description: Zigbee2mqtt action sensor
      selector:
        entity:
          integration: mqtt
          domain: sensor
    single_action:
      name: Single Click Action
      default: []
      selector:
        action: {}
    double_action:
      name: Double Click Action
      default: []
      selector:
        action: {}
    hold_action:
      name: Hold Action
      default: []
      selector:
        action: {}
    release_action:
      name: Release Action
      default: []
      selector:
        action: {}
    shake_action:
      name: Shake Action
      default: []
      selector:
        action: {}
mode: restart
max_exceeded: silent
trigger:
  platform: state
  entity_id: !input 'action_sensor'
  attribute: action
action:
- variables:
    command: '{{ trigger.to_state.state }}'
- choose:
  - conditions: '{{ command == ''single'' }}'
    sequence: !input 'single_action'
  - conditions: '{{ command == ''double'' }}'
    sequence: !input 'double_action'
  - conditions: '{{ command == ''hold'' }}'
    sequence: !input 'hold_action'
  - conditions: '{{ command == ''release'' }}'
    sequence: !input 'release_action'
  - conditions: '{{ command == ''shake'' }}'
    sequence: !input 'shake_action'

Thanks for the blueprint it is very useful. But seem that there is an error in it.
What worked for me, looks like this:

action:
- variables:
    command: '{{ trigger.to_state.attributes.action }}'

Thanks anyway.