Last active
August 13, 2023 18:56
-
-
Save jackbuehner/abb3cd39a06b6b8d9821fadd4cacc686 to your computer and use it in GitHub Desktop.
ZHA - Lutron Aurora Dimmer - Toggle v1.0 (Jack's fork)
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: ZHA - Lutron Aurora Dimmer - Toggle v1.0-g | |
description: 'Control lights with a Lutron Aurora Dimmer Pressing in the dimmer | |
button will toggle lights regardless of dimmer status. Rotating the dimmer will increase and decrease the light brightness. | |
Adjust the sensitivity if updates from the dimmer are being sent too quickly. Based on the great work of bjpetit!' | |
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) | |
description: The light(s) to control | |
selector: | |
target: | |
entity: | |
domain: light | |
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/jackbuehner/abb3cd39a06b6b8d9821fadd4cacc686 | |
mode: restart | |
max_exceeded: silent | |
trigger: | |
- platform: event | |
event_type: zha_event | |
event_data: | |
device_id: !input 'remote' | |
action: | |
- variables: | |
sensitivity_input: !input 'sensitivity' | |
selected_light: !input 'light' | |
sensitivity: "{% if sensitivity_input == \"3\" %}\n 1\n{% elif sensitivity_input\ | |
\ == \"2\" %}\n 5\n{% else %}\n 15\n{% endif %} \n" | |
prior_brightness: "{{ int(state_attr(selected_light.entity_id, 'brightness'), 0) }}" | |
command: '{{ trigger.event.data.command }}' | |
brightness: '{{ (trigger.event.data.args[0]|int) / (sensitivity|int) * (sensitivity|int) | |
}}' | |
presstype: '{{ (trigger.event.data.args[1]|int) }}' | |
- choose: | |
- conditions: | |
- "{{ command == 'move_to_level_with_on_off' }}" | |
- "{{ prior_brightness == 0 }}" | |
- "{{ presstype == 2 }}" | |
sequence: | |
- service: light.turn_off | |
target: "{{ selected_light }}" | |
- conditions: | |
- '{{ command == ''move_to_level_with_on_off'' }}' | |
- '{{ brightness > 0 }}' | |
- '{{ brightness != prior_brightness }}' | |
- '{{ presstype == 2}}' | |
sequence: | |
- service: light.turn_on | |
target: '{{ selected_light }}' | |
data: | |
brightness: '{{ brightness }}' | |
- conditions: | |
- '{{ command == ''move_to_level_with_on_off'' }}' | |
- '{{ presstype == 7}}' | |
sequence: | |
- service: light.toggle | |
target: '{{ selected_light }}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment