Last active
June 30, 2022 06:25
-
-
Save blizzrdof77/f74358b38b84cd1686c2f13ebcab1dab to your computer and use it in GitHub Desktop.
Xiaomi Wireless Remote Switch (WXKG01LM) via Xiaomi Gateway 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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