Last active
May 27, 2022 23:32
-
-
Save blizzrdof77/15cbdc862a09b7a0fa7e92686c2bea3c to your computer and use it in GitHub Desktop.
HASS Blueprint | Hue Event - Philips Hue Dimmer Switch Controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Hue Event - Philips Hue Dimmer Switch Controller (v1) | |
description: Control lights with a Philips Hue Dimmer Switch controller connected via the Philips Hue integration (using 'hue_event' as the trigger). | |
domain: automation | |
source_url: https://gist.github.com/blizzrdof77/15cbdc862a09b7a0fa7e92686c2bea3c | |
input: | |
remote: | |
name: Remote | |
description: Philips Hue Dimmer Switch controller to use. | |
selector: | |
device: | |
manufacturer: Signify Netherlands B.V. | |
model: Hue dimmer switch (RWL021) | |
# integration: Philips Hue | |
linked_entity_id: | |
name: Linked Entity (Optional) | |
description: Optionally link an entity to use it's custom attributes defined in customize.yaml. | |
default: "" | |
selector: | |
entity: {} | |
use_area: | |
name: Use Linked Entity Area | |
description: If checked, the light group will be automatically selected based on the linked entity target_area_id attribute in customize.yaml. | |
default: false | |
selector: | |
boolean: {} | |
light: | |
name: Light(s) | |
description: The light or light group to control. | |
selector: | |
entity: | |
domain: light | |
sensitivity: | |
name: Sensitivity | |
description: Reducing sensitivity will reduce rate of brightness change. | |
default: 5.0 | |
selector: | |
number: | |
min: 1.00 | |
max: 10.00 | |
step: 0.01 | |
mode: slider | |
repeats: | |
name: Repeats | |
description: Number of times to loop brightness change. | |
default: 3 | |
selector: | |
number: | |
min: 1 | |
max: 10 | |
step: 1 | |
mode: slider | |
transition_time: | |
name: Transition | |
description: Transition time in seconds. | |
default: 1.0 | |
selector: | |
number: | |
min: 0.00 | |
max: 5.00 | |
step: 0.01 | |
mode: slider | |
delay_time: | |
name: Delay Time | |
description: Delay in seconds to adapt sensitivity. | |
default: 0.50 | |
selector: | |
number: | |
min: 0.01 | |
max: 5.00 | |
step: 0.01 | |
mode: slider | |
top_button_press: | |
name: Top-Button Press | |
description: Action to run on Top-Button Press. | |
default: [] | |
selector: | |
action: {} | |
bottom_button_press: | |
name: Bottom-Button Press | |
description: Action to run on Bottom-Button Press. | |
default: [] | |
selector: | |
action: {} | |
mode: single | |
max_exceeded: silent | |
trigger: | |
- device_id: !input 'remote' | |
id: press_single | |
domain: zha | |
platform: device | |
type: remote_button_short_press | |
subtype: turn_on | |
- device_id: !input 'remote' | |
id: press_double | |
domain: zha | |
platform: device | |
type: remote_button_bottom_button_press | |
subtype: turn_on | |
- device_id: !input 'remote' | |
id: rotate_right | |
domain: zha | |
platform: device | |
type: device_rotated | |
subtype: right | |
- device_id: !input 'remote' | |
id: rotate_left | |
domain: zha | |
platform: device | |
type: device_rotated | |
subtype: left | |
# condition: | |
# - condition: template | |
# value_template: "{{ trigger.event.data.command != 'stop' }}" | |
action: | |
- variables: | |
command: '{{ trigger.event.data.command }}' | |
cluster_id: '{{ trigger.event.data.cluster_id }}' | |
endpoint_id: '{{ trigger.event.data.endpoint_id }}' | |
args: '{{ trigger.event.data.args }}' | |
sensitivity: !input 'sensitivity' | |
transition_time: !input 'transition_time' | |
delay_time: !input 'delay_time' | |
repeats: !input 'repeats' | |
linked_entity: !input 'linked_entity_id' | |
light_entity: !input 'light' | |
use_entity_area: !input 'use_area' | |
- variables: | |
brightness_change_pct: '{%- set brightness_change_pct = (sensitivity|float/2)|float -%}{{ brightness_change_pct }}' | |
repetitions: '{{ repeats|int }}' | |
target_entity_id: >- | |
{%- if linked_entity is defined and linked_entity != "" -%} | |
{%- set entity_target = state_attr(linked_entity, 'target_entity_id') -%} | |
{%- set entity_area = state_attr(linked_entity, 'target_area_id') -%} | |
{%- if use_entity_area == true and (entity_area != None and entity_area != '') -%} | |
{%- set area_slug = entity_area|lower|replace(' ', '_') -%} | |
{%- set lights = namespace(all='group.'+area_slug+'_lights', evening='group.'+area_slug+'_evening_lights', daytime='group.'+area_slug+'_daytime_lights') -%} | |
{%- if is_state('sensor.continue_circadian_sequence', 'on') -%} | |
{{ lights.all }} | |
{%- elif is_state(lights.daytime, 'on') -%} | |
{{ lights.all }} | |
{%- else -%} | |
{{ lights.evening }} | |
{%- endif -%} | |
{%- elif (entity_target != None and entity_target != '') -%} | |
{{ entity_target }} | |
{%- else -%} | |
{{ light_entity }} | |
{%- endif -%} | |
{%- else -%} | |
{{ light_entity }} | |
{%- endif -%} | |
- choose: | |
- conditions: | |
- condition: trigger | |
id: press_single | |
sequence: !input 'top_button_press' | |
- conditions: | |
- condition: trigger | |
id: press_double | |
sequence: !input 'bottom_button_press' | |
- conditions: | |
- condition: trigger | |
id: press_triple | |
sequence: !input 'triple_press' | |
- conditions: | |
- condition: trigger | |
id: rotate_right | |
sequence: | |
- repeat: | |
count: '{{ repetitions|int }}' | |
sequence: | |
- service: light.turn_on | |
data: | |
entity_id: '{{ target_entity_id }}' | |
brightness_step_pct: '{{ brightness_change_pct|float }}' | |
transition: '{{ transition_time|float }}' | |
- delay: '{{ delay_time|float }}' | |
- conditions: | |
- condition: trigger | |
id: rotate_left | |
sequence: | |
- repeat: | |
count: '{{ repetitions|int }}' | |
sequence: | |
- service: light.turn_on | |
data: | |
entity_id: '{{ target_entity_id }}' | |
brightness_step_pct: '{{ ((brightness_change_pct|float) * -1)|float }}' | |
transition: '{{ transition_time|float }}' | |
- delay: '{{ delay_time|float }}' | |
# -- | |
# - [1] - TOP BUTTON ["|"] ('subtype' => 1) | |
# -- | |
## -- [1] INITIAL PRESS ('type' => 'initial_press') | |
# { | |
# "event_type": "hue_event", | |
# "data": { | |
# "id": "hue_dimmer_switch_controller_1_button", | |
# "device_id": "1fd10604c34fabd671483540a6594a2d", | |
# "unique_id": "9f0927d2-637a-44b6-b616-5ff4c96edff8", | |
# "type": "initial_press", | |
# "subtype": 1 | |
# }, | |
# "origin": "LOCAL", | |
# "time_fired": "2022-05-27T22:57:05.988191+00:00", | |
# "context": { | |
# "id": "018107bcd9c4546aa6f521aaa10e752d", | |
# "parent_id": null, | |
# "user_id": null | |
# } | |
# } | |
## -- [1] SHORT RELEASE ('type' => 'short_release') | |
# { | |
# "event_type": "hue_event", | |
# "data": { | |
# "id": "hue_dimmer_switch_controller_1_button", | |
# "device_id": "1fd10604c34fabd671483540a6594a2d", | |
# "unique_id": "9f0927d2-637a-44b6-b616-5ff4c96edff8", | |
# "type": "short_release", | |
# "subtype": 1 | |
# }, | |
# "origin": "LOCAL", | |
# "time_fired": "2022-05-27T22:57:06.997442+00:00", | |
# "context": { | |
# "id": "018107bcddb50efa9b4ac2f6fd527cf9", | |
# "parent_id": null, | |
# "user_id": null | |
# } | |
# } | |
## -- [1] REPEAT ('type' => 'repeat') | |
# { | |
# "event_type": "hue_event", | |
# "data": { | |
# "id": "hue_dimmer_switch_controller_1_button", | |
# "device_id": "1fd10604c34fabd671483540a6594a2d", | |
# "unique_id": "9f0927d2-637a-44b6-b616-5ff4c96edff8", | |
# "type": "repeat", | |
# "subtype": 1 | |
# }, | |
# "origin": "LOCAL", | |
# "time_fired": "2022-05-27T22:57:10.340260+00:00", | |
# "context": { | |
# "id": "018107bceac4562b93b25a8f863adae8", | |
# "parent_id": null, | |
# "user_id": null | |
# } | |
# } | |
## -- [1] LONG RELEASE ('type' => 'long_release') | |
# { | |
# "event_type": "hue_event", | |
# "data": { | |
# "id": "hue_dimmer_switch_controller_1_button", | |
# "device_id": "1fd10604c34fabd671483540a6594a2d", | |
# "unique_id": "9f0927d2-637a-44b6-b616-5ff4c96edff8", | |
# "type": "long_release", | |
# "subtype": 1 | |
# }, | |
# "origin": "LOCAL", | |
# "time_fired": "2022-05-27T22:57:11.390913+00:00", | |
# "context": { | |
# "id": "018107bceede31bbb0e87560a6cb8b2f", | |
# "parent_id": null, | |
# "user_id": null | |
# } | |
# } | |
# -- | |
# - [2] - INCREASE BRIGHTNESS BUTTON [larger "*"] ('subtype' => 2) | |
# -- | |
## -- [2] INITIAL PRESS ('type' => 'initial_press') | |
# { | |
# "event_type": "hue_event", | |
# "data": { | |
# "id": "hue_dimmer_switch_controller_1_button", | |
# "device_id": "1fd10604c34fabd671483540a6594a2d", | |
# "unique_id": "f3540693-285c-4837-9e26-7e6669271fb6", | |
# "type": "initial_press", | |
# "subtype": 2 | |
# }, | |
# "origin": "LOCAL", | |
# "time_fired": "2022-05-27T22:48:00.227736+00:00", | |
# "context": { | |
# "id": "018107b485e386942f12ac7f511a654e", | |
# "parent_id": null, | |
# "user_id": null | |
# } | |
# } | |
## -- [2] SHORT RELEASE ('type' => 'short_release') | |
# { | |
# "event_type": "hue_event", | |
# "data": { | |
# "id": "hue_dimmer_switch_controller_1_button", | |
# "device_id": "1fd10604c34fabd671483540a6594a2d", | |
# "unique_id": "f3540693-285c-4837-9e26-7e6669271fb6", | |
# "type": "short_release", | |
# "subtype": 2 | |
# }, | |
# "origin": "LOCAL", | |
# "time_fired": "2022-05-27T22:48:01.237723+00:00", | |
# "context": { | |
# "id": "018107b489d59774590fe7d07892e0a0", | |
# "parent_id": null, | |
# "user_id": null | |
# } | |
# } | |
## -- [2] REPEAT ('type' => 'repeat') | |
# { | |
# "event_type": "hue_event", | |
# "data": { | |
# "id": "hue_dimmer_switch_controller_1_button", | |
# "device_id": "1fd10604c34fabd671483540a6594a2d", | |
# "unique_id": "f3540693-285c-4837-9e26-7e6669271fb6", | |
# "type": "repeat", | |
# "subtype": 2 | |
# }, | |
# "origin": "LOCAL", | |
# "time_fired": "2022-05-27T23:18:55.305683+00:00", | |
# "context": { | |
# "id": "018107d0d449fb5ed1fa31f057804fce", | |
# "parent_id": null, | |
# "user_id": null | |
# } | |
# } | |
## -- [2] LONG RELEASE ('type' => 'long_release') | |
# { | |
# "event_type": "hue_event", | |
# "data": { | |
# "id": "hue_dimmer_switch_controller_1_button", | |
# "device_id": "1fd10604c34fabd671483540a6594a2d", | |
# "unique_id": "f3540693-285c-4837-9e26-7e6669271fb6", | |
# "type": "long_release", | |
# "subtype": 2 | |
# }, | |
# "origin": "LOCAL", | |
# "time_fired": "2022-05-27T23:18:56.315538+00:00", | |
# "context": { | |
# "id": "018107d0d83b5a713ed19783daedf0b9", | |
# "parent_id": null, | |
# "user_id": null | |
# } | |
# } | |
# -- | |
# - [3] - DECREASE BRIGHTNESS BUTTON [smaller "*"] ('subtype' => 3) | |
# -- | |
## -- [3] INITIAL PRESS ('type' => 'initial_press') | |
# { | |
# "event_type": "hue_event", | |
# "data": { | |
# "id": "hue_dimmer_switch_controller_1_button", | |
# "device_id": "1fd10604c34fabd671483540a6594a2d", | |
# "unique_id": "c802dff4-6c83-4cbf-8b58-f7fabdc5e5e1", | |
# "type": "initial_press", | |
# "subtype": 3 | |
# }, | |
# "origin": "LOCAL", | |
# "time_fired": "2022-05-27T22:48:13.312816+00:00", | |
# "context": { | |
# "id": "018107b4b900b3a01709a4557249dc50", | |
# "parent_id": null, | |
# "user_id": null | |
# } | |
# } | |
## -- [3] SHORT RELEASE ('type' => 'short_release') | |
# { | |
# "event_type": "hue_event", | |
# "data": { | |
# "id": "hue_dimmer_switch_controller_1_button", | |
# "device_id": "1fd10604c34fabd671483540a6594a2d", | |
# "unique_id": "c802dff4-6c83-4cbf-8b58-f7fabdc5e5e1", | |
# "type": "short_release", | |
# "subtype": 3 | |
# }, | |
# "origin": "LOCAL", | |
# "time_fired": "2022-05-27T22:48:14.320603+00:00", | |
# "context": { | |
# "id": "018107b4bcf067b2d880f34f3edf47ca", | |
# "parent_id": null, | |
# "user_id": null | |
# } | |
# } | |
## -- [3] REPEAT ('type' => 'repeat') | |
# { | |
# "event_type": "hue_event", | |
# "data": { | |
# "id": "hue_dimmer_switch_controller_1_button", | |
# "device_id": "1fd10604c34fabd671483540a6594a2d", | |
# "unique_id": "c802dff4-6c83-4cbf-8b58-f7fabdc5e5e1", | |
# "type": "repeat", | |
# "subtype": 3 | |
# }, | |
# "origin": "LOCAL", | |
# "time_fired": "2022-05-27T23:20:43.665647+00:00", | |
# "context": { | |
# "id": "018107d27b91fd5f514b53752793e31f", | |
# "parent_id": null, | |
# "user_id": null | |
# } | |
# } | |
## -- [3] LONG RELEASE ('type' => 'long_release') | |
# { | |
# "event_type": "hue_event", | |
# "data": { | |
# "id": "hue_dimmer_switch_controller_1_button", | |
# "device_id": "1fd10604c34fabd671483540a6594a2d", | |
# "unique_id": "c802dff4-6c83-4cbf-8b58-f7fabdc5e5e1", | |
# "type": "long_release", | |
# "subtype": 3 | |
# }, | |
# "origin": "LOCAL", | |
# "time_fired": "2022-05-27T23:20:44.700892+00:00", | |
# "context": { | |
# "id": "018107d27f9c685b5fd1b38a7de69d96", | |
# "parent_id": null, | |
# "user_id": null | |
# } | |
# } | |
# -- | |
# - [4] - BOTTOM BUTTON ["o"] ('subtype' => 4) | |
# -- | |
## -- [4] INITIAL PRESS ('type' => 'initial_press') | |
# { | |
# "event_type": "hue_event", | |
# "data": { | |
# "id": "hue_dimmer_switch_controller_1_button", | |
# "device_id": "1fd10604c34fabd671483540a6594a2d", | |
# "unique_id": "7b019307-77fd-4b29-a7a5-5c0cad0c345e", | |
# "type": "initial_press", | |
# "subtype": 4 | |
# }, | |
# "origin": "LOCAL", | |
# "time_fired": "2022-05-27T23:14:26.457192+00:00", | |
# "context": { | |
# "id": "018107ccba193b3fa0f747e3d9504578", | |
# "parent_id": null, | |
# "user_id": null | |
# } | |
# } | |
## -- [4] SHORT RELEASE ('type' => 'short_release') | |
# { | |
# "event_type": "hue_event", | |
# "data": { | |
# "id": "hue_dimmer_switch_controller_1_button", | |
# "device_id": "1fd10604c34fabd671483540a6594a2d", | |
# "unique_id": "7b019307-77fd-4b29-a7a5-5c0cad0c345e", | |
# "type": "short_release", | |
# "subtype": 4 | |
# }, | |
# "origin": "LOCAL", | |
# "time_fired": "2022-05-27T23:14:27.465749+00:00", | |
# "context": { | |
# "id": "018107ccbe09c3084552f73f7c3ac712", | |
# "parent_id": null, | |
# "user_id": null | |
# } | |
# } | |
## -- [4] REPEAT ('type' => 'repeat') | |
# { | |
# "event_type": "hue_event", | |
# "data": { | |
# "id": "hue_dimmer_switch_controller_1_button", | |
# "device_id": "1fd10604c34fabd671483540a6594a2d", | |
# "unique_id": "7b019307-77fd-4b29-a7a5-5c0cad0c345e", | |
# "type": "repeat", | |
# "subtype": 4 | |
# }, | |
# "origin": "LOCAL", | |
# "time_fired": "2022-05-27T23:14:36.698300+00:00", | |
# "context": { | |
# "id": "018107cce21a6a474d784f99031c8cc7", | |
# "parent_id": null, | |
# "user_id": null | |
# } | |
# } | |
## -- [4] LONG RELEASE ('type' => 'long_release') | |
# { | |
# "event_type": "hue_event", | |
# "data": { | |
# "id": "hue_dimmer_switch_controller_1_button", | |
# "device_id": "1fd10604c34fabd671483540a6594a2d", | |
# "unique_id": "7b019307-77fd-4b29-a7a5-5c0cad0c345e", | |
# "type": "long_release", | |
# "subtype": 4 | |
# }, | |
# "origin": "LOCAL", | |
# "time_fired": "2022-05-27T23:14:37.705429+00:00", | |
# "context": { | |
# "id": "018107cce60956aa989640733e474aa9", | |
# "parent_id": null, | |
# "user_id": null | |
# } | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment