Hi,
Just made my first Blueprint for taking a paired Philips Hue Dimmer Switch (RWL021) into use with pre-defined settings. My target was to create a Blueprint that would make pairing switch and light as easy and fast as possible because I’m planning to move from Deconz to ZHA and I have about 100 lights to control. So it would have been quite huge work without a suitable Blueprint. I also wanted as less parameters as possible for making this fast so to use this Blueprint you only need to set the switch and light/light group.
The Blueprint has my own settings that you can modify the way you like. With my settings, pressing
- "On", will turn the light on with full brightness and 3400 Kelvin.
- "Increase" will turn the light on with 70% brightness and 3400 Kelvin. Holding the button will just increase the current brightness.
- "Decrease" will turn the light on with 20% brightness and 2300 Kelvin. Holding the button will just decrease the current brightness.
- "Off" will turn off the light.
blueprint:
domain: automation
name: Controlling lights using Philips Hue Dimmer Switch (RWL021)
description: Take the swith fast into use with pre-set configuration.
input:
zha_device:
name: Philips Hue Dimmer Switch (RWL021 only)
description: The swith to be taken into use.
selector:
device:
integration: zha
model: RWL021
multiple: false
zha_entity_light:
name: Light or a light group
description: Light or a light group to be controlled.
selector:
entity:
multiple: true
integration: zha
domain: light
source_url: https://gist.github.com/Rantaki/33c9e74821e08c4419539e7a8e46007c
mode: queued
max_exceeded: silent
variables:
device_id: !input zha_device
trigger:
- platform: event
event_type: zha_event
condition: '{{ trigger.event.data.device_id == device_id }}'
action:
- variables:
command_type: '{{ trigger.event.data.command }}'
- service: logbook.log
data:
name: Device
message: '{{ device_id }}'
- service: logbook.log
data:
name: Command
message: '{{ command_type }}'
- service: logbook.log
data:
name: device_id
message: '{{ trigger.event.data.device_id }}'
- choose:
- conditions: '{{ command_type == "on_press" }}'
sequence:
- service: light.turn_on
data:
brightness_pct: 100
transition: 0.3
target:
entity_id: !input zha_entity_light
- conditions: '{{ command_type == "off_press" }}'
sequence:
- service: light.turn_off
target:
entity_id: !input zha_entity_light
data:
transition: 0.3
- conditions: '{{ command_type == "down_hold" }}'
sequence:
- service: light.turn_on
data:
brightness_step_pct: -15
transition: 0.4
target:
entity_id: !input zha_entity_light
- conditions: '{{ command_type == "up_hold" }}'
sequence:
- service: light.turn_on
data:
brightness_step_pct: 15
transition: 0.4
target:
entity_id: !input zha_entity_light
- conditions: '{{ command_type == "up_short_release" }}'
sequence:
- service: light.turn_on
data:
brightness_pct: 70
transition: 0.3
target:
entity_id: !input zha_entity_light
- conditions: '{{ command_type == "down_short_release" }}'
sequence:
- service: light.turn_on
data:
brightness_pct: 40
transition: 0.3
target:
entity_id: !input zha_entity_light
- choose:
- conditions: '{{ command_type == "on_press" or command_type == "up_short_release" }}'
sequence:
- delay: 0.4
- service: light.turn_on
data:
kelvin: 3400
transition: 0.5
target:
entity_id: !input zha_entity_light
- conditions: '{{ command_type == "down_short_release" }}'
sequence:
- delay: 0.4
- service: light.turn_on
data:
kelvin: 2300
transition: 0.5
target:
entity_id: !input zha_entity_light
I hope someone can save time with this!