Skip to content

Instantly share code, notes, and snippets.

@rdbahm
Forked from smartqasa/lutron_pico_5_light.yaml
Last active September 21, 2024 22:17
Show Gist options
  • Save rdbahm/262293fb032a93dbdae4073cebf8e5f8 to your computer and use it in GitHub Desktop.
Save rdbahm/262293fb032a93dbdae4073cebf8e5f8 to your computer and use it in GitHub Desktop.
Zooz ZEN34 - Light Entity Control
blueprint:
name: Zooz ZEN34 - Light Entity Control
description: "This blueprint allows for the association of a Zooz ZEN34 remote with a light entity. It is designed to simulate the operation of a ZEN34 using direct association including the press and hold functionality for the raise/lower buttons."
source_url: https://gist.github.com/rdbahm/262293fb032a93dbdae4073cebf8e5f8
domain: automation
input:
pico_1:
name: Remote
description: "Remote to associate with light entity."
selector:
device:
filter:
- model: ZEN34
- model: ZEN37 800LR
entity:
name: Light Entity(ies)
description: "Light entity to control."
selector:
entity:
domain: light
multiple: true
transition_on:
name: On Transition
description: "The duration in seconds for the light entity to transiton on."
selector:
number:
min: 0
max: 15
unit_of_measurement: seconds
default: 1
transition_off:
name: Off Transition
description: "The duration in seconds for the light entity to transiton off."
selector:
number:
min: 0
max: 15
unit_of_measurement: seconds
default: 2
step:
name: Brightness Step Percentage
description: "The percentage of brightness to which the light is changed when the RAISE/LOWER buttons are pressed and held."
selector:
number:
min: 1
max: 33
unit_of_measurement: percentage
default: 10
speed:
name: Brightness Transition Speed
description: "The rate of speed in milliseconds at which the brightness of the light entity will be changed."
selector:
number:
min: 100
max: 2000
unit_of_measurement: milliseconds
default: 500
round_transition_speed:
name: Brightness Transition Round to Nearest Second
description: "Some lighting platforms only support whole seconds of transition. Using this option sets the transition to round up to the nearest second, resulting in a smoother fade."
selector:
boolean:
default: true
trigger:
- platform: device
device_id: !input pico_1
domain: zwave_js
type: event.value_notification.central_scene
property: scene
property_key: "001"
endpoint: 0
command_class: 91
subtype: Endpoint 0 Scene 001
value: 0
id: on_pressed
- platform: device
device_id: !input pico_1
domain: zwave_js
type: event.value_notification.central_scene
property: scene
property_key: "001"
endpoint: 0
command_class: 91
subtype: Endpoint 0 Scene 001
value: 2
id: up_pressed
- platform: device
device_id: !input pico_1
domain: zwave_js
type: event.value_notification.central_scene
property: scene
property_key: "001"
endpoint: 0
command_class: 91
subtype: Endpoint 0 Scene 001
value: 1
id: up_released
- platform: device
device_id: !input pico_1
domain: zwave_js
type: event.value_notification.central_scene
property: scene
property_key: "002"
endpoint: 0
command_class: 91
subtype: Endpoint 0 Scene 002
value: 2
id: down_pressed
- platform: device
device_id: !input pico_1
domain: zwave_js
type: event.value_notification.central_scene
property: scene
property_key: "002"
endpoint: 0
command_class: 91
subtype: Endpoint 0 Scene 002
value: 1
id: down_released
- platform: device
device_id: !input pico_1
domain: zwave_js
type: event.value_notification.central_scene
property: scene
property_key: "002"
endpoint: 0
command_class: 91
subtype: Endpoint 0 Scene 002
value: 0
id: off_pressed
variables:
step: !input step
speed: !input speed
condition: []
action:
- variables:
transition_time: >
{% if round_transition_speed %}
{{ ((speed + 999) / 1000) | int(1) }}
{% else %}
{{ speed / 1000 }}
{% endif %}
- choose:
- conditions:
- condition: trigger
id: on_pressed
sequence:
- service: light.turn_on
data:
transition: !input transition_on
brightness_pct: 100
target:
entity_id: !input entity
- conditions:
- condition: trigger
id: up_pressed
sequence:
- repeat:
sequence:
- service: light.turn_on
data:
brightness_step_pct: !input step
transition: "{{ transition_time }}"
target:
entity_id: !input entity
- delay:
milliseconds: !input speed
until:
- condition: state
entity_id: !input entity
attribute: brightness
state: "100"
- conditions:
- condition: trigger
id: up_released
sequence:
- delay:
milliseconds: 100
- conditions:
- condition: trigger
id: down_pressed
sequence:
- repeat:
sequence:
- service: light.turn_on
data:
brightness_step_pct: "{{ step * -1 }}"
transition: "{{ transition_time }}"
target:
entity_id: !input entity
- delay:
milliseconds: !input speed
until:
- condition: numeric_state
entity_id: !input entity
attribute: brightness
below: 1
- conditions:
- condition: trigger
id: down_released
sequence:
- delay:
milliseconds: 100
- conditions:
- condition: trigger
id: off_pressed
sequence:
- service: light.turn_off
data:
transition: !input transition_off
target:
entity_id: !input entity
mode: restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment