Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blizzrdof77/f74358b38b84cd1686c2f13ebcab1dab to your computer and use it in GitHub Desktop.
Save blizzrdof77/f74358b38b84cd1686c2f13ebcab1dab to your computer and use it in GitHub Desktop.
Xiaomi Wireless Remote Switch (WXKG01LM) via Xiaomi Gateway 3
blueprint:
name: Xiaomi Wireless Remote Switch (WXKG01LM) via Xiaomi Gateway 3
description: Automate your Xiaomi Mijia Wireless Round Remote Switch connected via the Xiaomi Gateway 3 and associated custom Home Assistant integration.
source_url: https://gist.github.com/blizzrdof77/f74358b38b84cd1686c2f13ebcab1dab
domain: automation
input:
button_sensor:
name: Button Sensor Entity
description: The sensor attached to the button device.
selector:
entity:
domain: sensor
device_class: action
linked_entity_id:
name: Linked Entity (Optional)
description: Optionally link an entity to use it's custom attributes defined in customize.yaml.
default: ''
selector:
entity: {}
remote_button_single_press:
name: Single Press
description: Action to run on single press
default: []
selector:
action: {}
remote_button_double_press:
name: Double Press
description: Action to run on double press
default: []
selector:
action: {}
remote_button_triple_press:
name: Triple Press
description: Action to run on triple press
default: []
selector:
action: {}
remote_button_quadruple_press:
name: Quadruple Press
description: Action to run on quadruple press
default: []
selector:
action: {}
remote_button_multiple_press:
name: Multiple Press
description: Action to run on multiple press
default: []
selector:
action: {}
remote_button_hold:
name: Hold
description: Action to run on hold
default: []
selector:
action: {}
remote_button_release:
name: Release
description: Action to run on release
default: []
selector:
action: {}
mode: parallel
max_exceeded: silent
trigger:
- platform: event
event_type: state_changed
event_data:
entity_id: !input 'button_sensor'
action:
- variables:
button_entity: !input 'button_sensor'
linked_entity: !input 'linked_entity_id'
action: >-
{%- if trigger.event.data.new_state is defined -%}
{{ (trigger.event.data.new_state.state|default('')|string) }}
{%- else -%}
{{ '' }}
{%- endif -%}
default_state: >-
{{ action|string != '' }}
- 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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment