Skip to content

Instantly share code, notes, and snippets.

@seamus65
Last active January 16, 2023 10:08
Show Gist options
  • Save seamus65/c35766e14c54594db8a7fd5b1fc0d971 to your computer and use it in GitHub Desktop.
Save seamus65/c35766e14c54594db8a7fd5b1fc0d971 to your computer and use it in GitHub Desktop.
blueprint tutorial
blueprint:
name: ZHA - Mijia Wireless Switch
description: 'Perform actions with the Mijia Wireless Switch.
You can set functions for single press, double press, triple press, quadruple press and furious (5 or more presses). This allows you to assign,
e.g., a scene or anything else.'
domain: automation
input:
remote:
name: Remote
description: LUMI Button to use
selector:
device:
integration: zha
manufacturer: LUMI
model: lumi.sensor_switch
single_press:
name: Single press
description: Action to run on single press
default: []
selector:
action: {}
double_press:
name: Double press
description: Action to run on double press
default: []
selector:
action: {}
triple_press:
name: Triple press
description: Action to run on triple press
default: []
selector:
action: {}
quadruple_press:
name: Quadruple press
description: Action to run on quadruple press
default: []
selector:
action: {}
furious_press:
name: Furious press
description: Action to run on furious press
default: []
selector:
action: {}
source_url: https://gist.github.com/seamus65/c35766e14c54594db8a7fd5b1fc0d971
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input 'remote'
action:
- variables:
command: '{{ trigger.event.data.command }}'
cluster_id: '{{ trigger.event.data.cluster_id }}'
endpoint_id: '{{ trigger.event.data.endpoint_id }}'
args: '{{ trigger.event.data.args.click_type }}'
- choose:
- conditions:
- '{{ command == "click" }}'
- '{{ cluster_id == 6 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == "single" }}'
sequence: !input 'single_press'
- conditions:
- '{{ command == "click" }}'
- '{{ cluster_id == 6 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == "double" }}'
sequence: !input 'double_press'
- conditions:
- '{{ command == "click" }}'
- '{{ cluster_id == 6 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == "triple" }}'
sequence: !input 'triple_press'
- conditions:
- '{{ command == "click" }}'
- '{{ cluster_id == 6 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == "quadruple" }}'
sequence: !input 'quadruple_press'
- conditions:
- '{{ command == "click" }}'
- '{{ cluster_id == 6 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == "furious" }}'
sequence: !input 'furious_press'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment