Skip to content

Instantly share code, notes, and snippets.

@jackbuehner
Last active January 17, 2024 05:26
Show Gist options
  • Save jackbuehner/1e531662b6d1e3789c03b4d0252543d6 to your computer and use it in GitHub Desktop.
Save jackbuehner/1e531662b6d1e3789c03b4d0252543d6 to your computer and use it in GitHub Desktop.
Caséta Paddle Pico Three-Level Brightness
blueprint:
name: Lutron paddle pico three-level brightness
description: Use an on/off pico remote to cycle through three levels of brightness
domain: automation
input:
pico_remotes:
name: Pico remotes
selector:
device:
model: PJ2-1P-GXX (PaddleSwitchPico)
multiple: true
lights:
name: Lights
selector:
entity:
filter:
domain: light
multiple: true
brightness_level_1:
name: Brightness level 1 (dimmest)
selector:
number:
min: 0
max: 100
step: 1
unit_of_measurement: "%"
mode: slider
default: 10
brightness_level_2:
name: Brightness level 2
selector:
number:
min: 0
max: 100
step: 1
unit_of_measurement: "%"
mode: slider
default: 50
brightness_level_3:
name: Brightness level 3 (brightest)
selector:
number:
min: 0
max: 100
step: 1
unit_of_measurement: "%"
mode: slider
default: 90
mode: queued
max: 4
trigger:
- platform: event
event_type: lutron_caseta_button_event
event_data:
type: PaddleSwitchPico
button_type: Button 0
action: press
id: on_pressed
- platform: event
event_type: lutron_caseta_button_event
event_data:
type: PaddleSwitchPico
button_type: Button 0
action: release
id: on_released
- platform: event
event_type: lutron_caseta_button_event
event_data:
type: PaddleSwitchPico
button_type: Button 2
action: press
id: off_pressed
- platform: event
event_type: lutron_caseta_button_event
event_data:
type: PaddleSwitchPico
button_type: Button 2
action: release
id: off_released
variables:
pico_remotes: !input pico_remotes
lights: !input lights
brightness_level_1: !input brightness_level_1
brightness_level_2: !input brightness_level_2
brightness_level_3: !input brightness_level_3
condition:
- condition: template
value_template: "{{ trigger.event.data.device_id in pico_remotes }}"
action:
- alias: act based on pressed button
choose:
- conditions:
- condition: trigger
id:
- on_released
alias: When on button pressed
sequence:
- alias: Cycle through brightness levels
choose:
- conditions:
- alias: When brightness is less than level 1
condition: template
value_template: >-
{{ state_attr(lights[0], 'brightness')|int(0) < (brightness_level_1/100*255)|int(0) }}
sequence:
- alias: Set the brightness to level 1
service: light.turn_on
data:
brightness: "{{ (brightness_level_1/100*255)|int(0) }}"
target:
entity_id: !input lights
- conditions:
- alias: When brightness is less than level 2
condition: template
value_template: >-
{{ state_attr(lights[0], 'brightness')|int(0) < (brightness_level_2/100*255)|int(0) }}
sequence:
- alias: Set the brightness to level 2
service: light.turn_on
data:
brightness: "{{ (brightness_level_2/100*255)|int(0) }}"
target:
entity_id: !input lights
- conditions:
- alias: When brightness is less than level 3
condition: template
value_template: >-
{{ state_attr(lights[0], 'brightness')|int(0) < (brightness_level_3/100*255)|int(0) }}
sequence:
- alias: Set the brightness to level 3
service: light.turn_on
data:
brightness: "{{ (brightness_level_3/100*255)|int(0) }}"
target:
entity_id: !input lights
# default:
# - alias: Set the brightness to level 1
# service: light.turn_on
# data:
# brightness: "{{ (brightness_level_1/100*255)|int(0) }}"
# target:
# entity_id: !input lights
- conditions:
- condition: trigger
id:
- off_released
alias: When off button pressed
sequence:
- alias: Turn off the lights
service: light.turn_off
data: {}
target:
entity_id: !input lights
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment