Skip to content

Instantly share code, notes, and snippets.

@manix84
Last active May 14, 2024 14:55
Show Gist options
  • Save manix84/8c94b97285e82c594aac3c1372f40660 to your computer and use it in GitHub Desktop.
Save manix84/8c94b97285e82c594aac3c1372f40660 to your computer and use it in GitHub Desktop.
An automation for Hue removes, which has brightness buttons (100%, 66%, 33%, 0%), and long presses turns off the automations.
blueprint:
name: Hue Remote Lights with Automation (ZHA Integration)
description: |
An automation for Hue removes, which has brightness buttons (100%, 66%, 33%, 0%), and long presses turns off the automations.
domain: automation
source_url: https://gist.github.com/manix84/8c94b97285e82c594aac3c1372f40660
author: Manix84
input:
dimmer_device_id:
name: Dimmer Remote
description: "Your Hue dimmer remote (e.g. RWL020, RWL021, RWL022); check Hue integration and/or Hue app if you don't know the name"
selector:
device:
filter:
- integration: zha
manufacturer: "Philips"
model: RWL020
- integration: zha
manufacturer: "Philips"
model: RWL021
- integration: zha
manufacturer: "Philips"
model: RWL022
multiple: false
button_1_pct:
name: "Button #1 Brightness"
description: <ha-icon icon="mdi:brightness-7"></ha-icon> Light brightness for top button
default: 100
selector:
number:
min: 0
max: 100
step: 1
unit_of_measurement: "%"
mode: slider
button_2_pct:
name: "Button #2 Brightness"
description: <ha-icon icon="mdi:brightness-6"></ha-icon> Light brightness for second button
default: 66
selector:
number:
min: 0
max: 100
step: 1
unit_of_measurement: "%"
mode: slider
button_3_pct:
name: "Button #3 Brightness"
description: <ha-icon icon="mdi:brightness-5"></ha-icon> Light brightness for third button
default: 33
selector:
number:
min: 0
max: 100
step: 1
unit_of_measurement: "%"
mode: slider
light_temperature:
name: Light Temperature
description: Temperature of the lights
default: 2700
selector:
color_temp:
unit: kelvin
light_entity_ids:
name: Lights
description: "The lights you want the remote to affect"
selector:
entity:
domain: light
on_speed_transition:
name: On Transition Speed
description: How fast to transition between states
default: 1
selector:
number:
min: 0
max: 10
step: 0.1
unit_of_measurement: Seconds
mode: slider
off_speed_transition:
name: Off Transition Speed
description: How fast to transition to off state
default: 1
selector:
number:
min: 0
max: 10
step: 0.1
unit_of_measurement: Seconds
mode: slider
automation_entity_id:
name: Automation
description: "The automation you wish to pause"
selector:
entity:
filter:
- domain: "automation"
description: ""
trigger:
- id: on_pressed
device_id: !input dimmer_device_id
domain: zha
platform: device
type: remote_button_short_press
subtype: turn_on
- id: on_long_pressed
device_id: !input dimmer_device_id
domain: zha
platform: device
type: remote_button_long_release
subtype: turn_on
- id: off_pressed
device_id: !input dimmer_device_id
domain: zha
platform: device
type: remote_button_short_press
subtype: turn_off
- id: off_long_pressed
device_id: !input dimmer_device_id
domain: zha
platform: device
type: remote_button_long_release
subtype: turn_off
- id: dim_up_pressed
device_id: !input dimmer_device_id
domain: zha
platform: device
type: remote_button_short_press
subtype: dim_up
- id: dim_up_long_pressed
device_id: !input dimmer_device_id
domain: zha
platform: device
type: remote_button_long_release
subtype: dim_up
- id: dim_down_pressed
device_id: !input dimmer_device_id
domain: zha
platform: device
type: remote_button_short_press
subtype: dim_down
- id: dim_down_long_pressed
device_id: !input dimmer_device_id
domain: zha
platform: device
type: remote_button_long_release
subtype: dim_down
condition: []
action:
- choose:
- alias: Long Press of any button, turns off automation
conditions:
- condition: or
conditions:
- condition: trigger
id: on_long_pressed
- condition: trigger
id: off_long_pressed
- condition: trigger
id: dim_up_long_pressed
- condition: trigger
id: dim_down_long_pressed
sequence:
- service: automation.turn_off
data: {}
target:
entity_id: !input automation_entity_id
- service: light.turn_on
data:
flash: short
target:
entity_id: !input light_entity_ids
- if:
- condition: trigger
id: off_long_pressed
then:
- delay: 1
- service: light.turn_off
target:
entity_id: !input light_entity_ids
data: {}
- alias: "Button #1 Brightness"
conditions:
- condition: trigger
id: on_pressed
sequence:
- service: light.turn_on
data:
kelvin: !input light_temperature
brightness_pct: !input button_1_pct
transition: !input on_speed_transition
target:
entity_id: !input light_entity_ids
- service: automation.turn_on
data: {}
target:
entity_id: !input automation_entity_id
- alias: "Button #2 Brightness"
conditions:
- condition: trigger
id: dim_up_pressed
sequence:
- service: light.turn_on
data:
kelvin: !input light_temperature
brightness_pct: !input button_2_pct
transition: !input on_speed_transition
target:
entity_id: !input light_entity_ids
- service: automation.turn_on
data: {}
target:
entity_id: !input automation_entity_id
- alias: "Button #3 Brightness"
conditions:
- condition: trigger
id: dim_down_pressed
sequence:
- service: light.turn_on
data:
kelvin: !input light_temperature
brightness_pct: !input button_3_pct
transition: !input on_speed_transition
target:
entity_id: !input light_entity_ids
- service: automation.turn_on
data: {}
target:
entity_id: !input automation_entity_id
- alias: Turn Off
conditions:
- condition: trigger
id: off_pressed
sequence:
- service: light.turn_off
data:
transition: !input off_speed_transition
target:
entity_id: !input light_entity_ids
- service: automation.turn_on
data: {}
target:
entity_id: !input automation_entity_id
default:
- service: persistent_notification.create
data:
message: >-
Hue dimmer ran default event from "choose" action on button press!
Please check any automations which may not be handling this event!
({{ trigger.id }}) {{ trigger.type }} - {{ trigger.subtype }}
notification_id: hue-remote-lights-with-automation
title: >-
Uncaught Dimmer Command ({{ trigger.id }})
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment