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/02e63ea606c49b41c27cf03a05b1ad86 to your computer and use it in GitHub Desktop.
Save blizzrdof77/02e63ea606c49b41c27cf03a05b1ad86 to your computer and use it in GitHub Desktop.
Blueprint for Lutron Aurora automations in ZHA (expanded)
blueprint:
name: ZHA - Lutron Aurora Dimmer Expanded v1.5
description: Control lights with a Lutron Aurora Dimmer Pressing in the dimmer button will toggle between turning lights on to full brightness, and turning the lights off. Rotating the dimmer will increase and decrease the light brightness. Adjust the sensitivity if updates from the dimmer are being sent too quickly.
domain: automation
input:
remote:
name: Lutron Aurora Dimmer Switch
description: Lutron Aurora Z3-1BRL
selector:
device:
integration: zha
manufacturer: Lutron
model: Z3-1BRL
entity:
domain: sensor
device_class: battery
light:
name: Light(s) or Entitie(s)
description: The light(s), group, or entity(s) to control.
default: ''
selector:
entity: {}
click_switch:
name: Use Click to Switch Device Control?
description: If selected, clicking will switch the target device controlled.
default: false
selector:
boolean: {}
input_select_devices:
name: Input select of the devices to alternate between.
description: Only valid/used if click_switch is set to true.
default: input_select.none
selector:
entity:
domain: input_select
sensitivity:
name: Sensitivity
description: Reducing sensitivity will reduce rate of changes being sent to lights
default: 3
selector:
number:
min: 1.0
max: 3.0
mode: slider
step: 1.0
source_url: https://gist.github.com/blizzrdof77/02e63ea606c49b41c27cf03a05b1ad86
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input 'remote'
# condition: []
action:
- variables:
sensitivity_input: !input 'sensitivity'
selected_light: !input 'light'
click_switch: !input 'click_switch'
device_opts: !input 'input_select_devices'
sensitivity: "{% if sensitivity_input == '3' %}1{% elif sensitivity_input == '2' %}5{% else %}15{% endif %}"
prior_brightness: '{{ brightness | default }}'
command: '{{ trigger.event.data.command }}'
brightness: '{{ (trigger.event.data.args[0]|int) / (sensitivity|int) * (sensitivity|int) }}'
is_this_a_click: '{{ (trigger.event.data.args[1]|int) == 7 }}'
target_entity_id: >-
{%- set target = states(device_opts)|replace('unknown', selected_light) -%}
{%- if states(target) == 'unknown' -%}
{%- set eid = 'group.all_' + (target|lower|replace(' ', '_')) + '_lights' -%}
{%- else -%}
{%- set eid = target -%}
{%- endif -%}
{{ eid }}
- choose:
- conditions:
- '{{ click_switch and is_this_a_click }}'
sequence:
- choose:
- conditions:
- '{{ brightness == 0 }}'
sequence:
- service: input_select.select_previous
data:
entity_id: '{{ device_opts }}'
cycle: true
default:
- service: input_select.select_next
data:
entity_id: '{{ device_opts }}'
cycle: true
- conditions:
- '{{ command == "move_to_level_with_on_off" }}'
- '{{ brightness != prior_brightness }}'
sequence:
- service: light.turn_on
data:
entity_id: '{{ target_entity_id }}'
brightness: '{%- if brightness|int == 2 -%}{{ 0 }}{%- else -%}{{ brightness }}{%- endif -%}'
default: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment