Skip to content

Instantly share code, notes, and snippets.

@califa
Created June 11, 2023 21:46
Show Gist options
  • Save califa/63f7a1bae25595a61f1d38e4973908d0 to your computer and use it in GitHub Desktop.
Save califa/63f7a1bae25595a61f1d38e4973908d0 to your computer and use it in GitHub Desktop.
blueprint:
name: Lutron Diva Extra Actions
description: |
Different Actions on Short, Long, and Double Click button presses.
There is no Double Click for up/down as those are slower to respond and produce bad experience.
domain: automation
input:
diva_id:
name: Lutron Diva
description: The Lutron Switch used to trigger the automations
selector:
device:
model: DVRF-6L (DivaSmartDimmer)
multiple: false
short_click_action_on:
name: On Button Short Click
description: The action(s) to launch for a single short click
default: []
selector:
action: {}
short_click_action_off:
name: Off Button Short Click
description: The action(s) to launch for a single short click
default: []
selector:
action: {}
long_click_action_on:
name: On Button Long Click
description: The action(s) to launch for a long click
default: []
selector:
action: {}
long_click_action_off:
name: Off Button Long Click
description: The action(s) to launch for a long click
default: []
selector:
action: {}
double_click_action_on:
name: On Button Double Click
description: The action(s) to launch for a double click
default: []
selector:
action: {}
double_click_action_off:
name: Off Button Double Click
description: The action(s) to launch for a double click
default: []
selector:
action: {}
delay_click:
name: Double Click Delay
description: The time in milliseconds used for the double click detection
default: 250
selector:
number:
min: 100
max: 1000
unit_of_measurement: milliseconds
step: 1
mode: slider
delay_hold:
name: Hold Delay
description: The time in milliseconds used for the hold detection
default: 1000
selector:
number:
min: 1000
max: 4000
unit_of_measurement: milliseconds
step: 1
mode: slider
trigger:
- platform: device
device_id: !input diva_id
domain: lutron_caseta
type: press
subtype: 'on'
id: on_pressed
- platform: device
device_id: !input diva_id
domain: lutron_caseta
type: press
subtype: raise
id: up_pressed
- platform: device
device_id: !input diva_id
domain: lutron_caseta
type: press
subtype: stop
id: stop_pressed
- platform: device
device_id: !input diva_id
domain: lutron_caseta
type: press
subtype: lower
id: down_pressed
- platform: device
device_id: !input diva_id
domain: lutron_caseta
type: press
subtype: 'off'
id: off_pressed
action:
- variables:
hold_ms: !input delay_hold
tap_ms: !input delay_click
diva_id: "{{ trigger.event.data.device_id }}"
button_name: "{{ trigger.event.data.button_type }}"
- choose:
- conditions:
- condition: trigger
id: on_pressed
sequence:
- wait_for_trigger:
- platform: device
device_id: !input diva_id
domain: lutron_caseta
type: release
subtype: "on"
timeout:
milliseconds: "{{ hold_ms }}"
- choose:
- conditions:
- condition: template
value_template: "{{ wait.trigger == none }}"
sequence: !input long_click_action_on
default:
- wait_for_trigger:
- platform: device
device_id: !input diva_id
domain: lutron_caseta
type: press
subtype: "on"
timeout:
milliseconds: "{{ tap_ms }}"
- choose:
- conditions:
- condition: template
value_template: "{{ wait.trigger == none }}"
sequence: !input short_click_action_on
default: !input double_click_action_on
- conditions:
- condition: trigger
id: up_pressed
sequence:
- wait_for_trigger:
- platform: device
device_id: !input diva_id
domain: lutron_caseta
type: release
subtype: raise
timeout:
milliseconds: "{{ hold_ms }}"
- choose:
- conditions:
- condition: template
value_template: "{{ wait.trigger == none }}"
sequence: !input long_click_action_up
default: !input short_click_action_up
- conditions:
- condition: trigger
id: stop_pressed
sequence:
- wait_for_trigger:
- platform: device
device_id: !input diva_id
domain: lutron_caseta
type: release
subtype: stop
timeout:
milliseconds: "{{ hold_ms }}"
- choose:
- conditions:
- condition: template
value_template: "{{ wait.trigger == none }}"
sequence: !input long_click_action_stop
default:
- wait_for_trigger:
- platform: device
device_id: !input diva_id
domain: lutron_caseta
type: press
subtype: stop
timeout:
milliseconds: "{{ tap_ms }}"
- choose:
- conditions:
- condition: template
value_template: "{{ wait.trigger == none }}"
sequence: !input short_click_action_stop
default: !input double_click_action_stop
- conditions:
- condition: trigger
id: down_pressed
sequence:
- wait_for_trigger:
- platform: device
device_id: !input diva_id
domain: lutron_caseta
type: release
subtype: lower
timeout:
milliseconds: "{{ hold_ms }}"
- choose:
- conditions:
- condition: template
value_template: "{{ wait.trigger == none }}"
sequence: !input long_click_action_down
default: !input short_click_action_down
- conditions:
- condition: trigger
id: off_pressed
sequence:
- wait_for_trigger:
- platform: device
device_id: !input diva_id
domain: lutron_caseta
type: release
subtype: "off"
timeout:
milliseconds: "{{ hold_ms }}"
- choose:
- conditions:
- condition: template
value_template: "{{ wait.trigger == none }}"
sequence: !input long_click_action_off
default:
- wait_for_trigger:
- platform: device
device_id: !input diva_id
domain: lutron_caseta
type: press
subtype: "off"
timeout:
milliseconds: "{{ tap_ms }}"
- choose:
- conditions:
- condition: template
value_template: "{{ wait.trigger == none }}"
sequence: !input short_click_action_off
default: !input double_click_action_off
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment