Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save inakianduaga/378d30c1de6282ccca94e9c57de6a2ad to your computer and use it in GitHub Desktop.
Save inakianduaga/378d30c1de6282ccca94e9c57de6a2ad to your computer and use it in GitHub Desktop.
Update to support brightness down properly
blueprint:
name: Hue Dimmer Remote Inaki Custom
description: |
(Dec 2021 Update) Using a Hue bridge with which a dimmer remote is paired, allows you to configure actions based on said Hue Dimmer Remote.
NOTE: tested with RWL020 and RWL022, but community says it also works with RWL021!
- Cover entity is optional
- Long off-press turns brightness to 1%
- Long On-press turn brightness up by 33%
domain: automation
source_url: https://gist.github.com/codycodes/f051781c35cfdfee15162ff680c9cbd8
input:
dimmer_device:
name: Dimmer Remote Device
description: "Your Hue dimmer remote (e.g. RWL020); check Hue integration and/or Hue app if you don't know the name"
selector:
device:
integration: hue
light_entity:
name: Light Entity
description: "The light or lights to control"
selector:
entity:
domain: light
cover_entity:
name: Cover Entity
description: "The cover or blinds to control"
selector:
entity:
domain: cover
default: null # Optional input, default is null
mode: single
trigger:
- device_id: !input dimmer_device
domain: hue
platform: device
type: short_release
subtype: 1
id: on short
- device_id: !input dimmer_device
domain: hue
platform: device
type: long_release
subtype: 1
id: on long
- device_id: !input dimmer_device
domain: hue
platform: device
type: short_release
subtype: 2
id: brightness up short
- device_id: !input dimmer_device
domain: hue
platform: device
type: long_release
subtype: 2
id: brightness up long
- device_id: !input dimmer_device
domain: hue
platform: device
type: short_release
subtype: 3
id: brightness down short
- device_id: !input dimmer_device
domain: hue
platform: device
type: long_release
subtype: 3
id: brightness down long
- device_id: !input dimmer_device
domain: hue
platform: device
type: short_release
subtype: 4
id: off short
- device_id: !input dimmer_device
domain: hue
platform: device
type: long_release
subtype: 4
id: off long
condition: []
action:
- variables:
cover_entity: !input cover_entity # Assign cover_entity input to a variable
light_entity: !input light_entity # Assign light_entity input to a variable
- choose:
- conditions:
- condition: trigger
id: on short
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entity }}"
data:
kelvin: 3600 # Set light temperature to 3600K (warm white)
brightness: 255 # Set brightness to 100%
- conditions:
- condition: trigger
id: on long
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entity }}"
data:
brightness: "{{ [(state_attr(light_entity, 'brightness') | int + 84), 255] | min | int }}" # Increase brightness by 33%, max 100%
- conditions:
- condition: trigger
id: off short
sequence:
- service: light.turn_off
target:
entity_id: "{{ light_entity }}"
- conditions:
- condition: trigger
id: off long
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entity }}"
data:
brightness: 3 # Set brightness to 1% (scaled from 1-255)
- conditions:
- condition: trigger
id: brightness up short
sequence:
- choose:
- conditions:
- condition: template
value_template: "{{ cover_entity is not none }}" # Check if cover_entity is specified
sequence:
- service: cover.open_cover
target:
entity_id: "{{ cover_entity }}"
- conditions:
- condition: trigger
id: brightness down short
sequence:
- choose:
- conditions:
- condition: template
value_template: "{{ cover_entity is not none }}" # Check if cover_entity is specified
sequence:
- service: cover.close_cover
target:
entity_id: "{{ cover_entity }}"
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!
notification_id: hue_dimmer_blueprint
title: Uncaught Dimmer Command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment