Compare commits

...

3 Commits

Author SHA1 Message Date
Pavel Kachalouski
eecac86657 Simplify philips_zigbee_dial.yaml 2024-12-02 21:28:04 +01:00
Pavel Kachalouski
eaf97cf14e Try set current light without conditions 2024-12-01 20:49:31 +01:00
Pavel Kachalouski
8e68d906b6 Added simple dimmer blueprint 2023-05-21 20:48:43 +02:00
2 changed files with 156 additions and 75 deletions

View File

@@ -58,23 +58,25 @@ blueprint:
source_url: https://github.com/xeppaka/ha-automations/blob/main/philips_zigbee_dial.yaml source_url: https://github.com/xeppaka/ha-automations/blob/main/philips_zigbee_dial.yaml
mode: restart mode: restart
max_exceeded: silent max_exceeded: silent
variables: variables:
first_light: !input "first_light" first_light: !input "first_light"
second_light: !input "second_light" second_light: !input "second_light"
third_light: !input "third_light" third_light: !input "third_light"
forth_light: !input "forth_light" forth_light: !input "forth_light"
current_light: !input "current_light"
dim_scale: !input "dim_scale" dim_scale: !input "dim_scale"
lights: lights:
first_light: !input "first_light" first_light: !input "first_light"
second_light: !input "second_light" second_light: !input "second_light"
third_light: !input "third_light" third_light: !input "third_light"
forth_light: !input "forth_light" forth_light: !input "forth_light"
trigger: trigger:
- platform: event - platform: event
event_type: zha_event event_type: zha_event
event_data: event_data:
device_id: !input "remote" device_id: !input "remote"
action: action:
- variables: - variables:
command: "{{ trigger.event.data.command }}" command: "{{ trigger.event.data.command }}"
@@ -90,14 +92,6 @@ action:
sequence: sequence:
- service: homeassistant.toggle - service: homeassistant.toggle
target: !input "first_light" target: !input "first_light"
- choose:
- conditions: "{{ current_light != none }}"
sequence:
- service: input_text.set_value
target:
entity_id: !input "current_light"
data:
value: first_light
- conditions: - conditions:
- "{{ command == 'recall' }}" - "{{ command == 'recall' }}"
- "{{ second_light != none }}" - "{{ second_light != none }}"
@@ -105,57 +99,21 @@ action:
sequence: sequence:
- service: homeassistant.toggle - service: homeassistant.toggle
target: !input "second_light" target: !input "second_light"
- choose: # - conditions:
- conditions: "{{ current_light != none }}" # - "{{ command == 'recall' }}"
sequence: # - "{{ third_light != none }}"
- service: input_text.set_value # - "{{ scene == 5 }}"
target: # sequence:
entity_id: !input "current_light" # - service: homeassistant.toggle
data: # target: !input "third_light"
value: second_light # - conditions:
- conditions: # - "{{ command == 'recall' }}"
- "{{ command == 'recall' }}" # - "{{ forth_light != none }}"
- "{{ third_light != none }}" # - "{{ scene == 4 }}"
- "{{ scene == 5 }}"
sequence:
- service: homeassistant.toggle
target: !input "third_light"
- choose:
- conditions: "{{ current_light != none }}"
sequence:
- service: input_text.set_value
target:
entity_id: !input "current_light"
data:
value: third_light
- conditions:
- "{{ command == 'recall' }}"
- "{{ forth_light != none }}"
- "{{ scene == 4 }}"
sequence:
- service: homeassistant.toggle
target: !input "forth_light"
- choose:
- conditions: "{{ current_light != none }}"
sequence:
- service: input_text.set_value
target:
entity_id: !input "current_light"
data:
value: forth_light
- conditions: - conditions:
- "{{ command == 'step_with_on_off' }}" - "{{ command == 'step_with_on_off' }}"
- "{{ step_mode == 'StepMode.Up' }}" - "{{ step_mode == 'StepMode.Up' }}"
sequence: sequence:
- choose:
- conditions: "{{ current_light != none }}"
sequence:
- service: light.turn_on
target: "{{ lights[states(current_light)] }}"
data:
brightness_step_pct: "{{ step_size * dim_scale }}"
transition: 1
default:
- service: light.turn_on - service: light.turn_on
target: !input "first_light" target: !input "first_light"
data: data:
@@ -165,15 +123,6 @@ action:
- "{{ command == 'step_with_on_off' }}" - "{{ command == 'step_with_on_off' }}"
- "{{ step_mode == 'StepMode.Down' }}" - "{{ step_mode == 'StepMode.Down' }}"
sequence: sequence:
- choose:
- conditions: "{{ current_light != none }}"
sequence:
- service: light.turn_on
target: "{{ lights[states(current_light)] }}"
data:
brightness_step_pct: "{{ -step_size * dim_scale }}"
transition: 1
default:
- service: light.turn_on - service: light.turn_on
target: !input "first_light" target: !input "first_light"
data: data:

View File

@@ -0,0 +1,132 @@
blueprint:
name: Philips Hue Dimmer Remote
description: "Control lights with a Philips Hue Dimmer Switch."
domain: automation
input:
remote:
name: Philips Hue Dimmer Switch
description: Pick either RWL020 (US) or RWL021 (EU) or RWL022 (EU)
selector:
device:
integration: zha
manufacturer: Signify Netherlands B.V.
model: RWL022
light:
name: Controlled light
description: The light(s) to control with single press
selector:
target:
entity: {}
force_brightness:
name: Force turn on brightness
description:
'Force the brightness to the set level below, when the "on" button
on the remote is pushed and lights turn on.'
default: false
selector:
boolean: {}
brightness:
name: Brightness
description: Brightness of the light(s) when turning on
default: 100
selector:
number:
min: 0.0
max: 100.0
mode: slider
step: 1.0
unit_of_measurement: "%"
current_light:
name: (OPTIONAL) Current Light
description:
'Text helper to track the current light to dim. Set for the dimmer controls to change which light they are controlling according to the last one turned on.
For instance, double press "on" and then the dimmer buttons will control the Double Press Light'
default:
selector:
entity:
domain: input_text
source_url: https://github.com/xeppaka/ha-automations/blob/main/philips_zigbee_dimmer_simple.yaml
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input "remote"
action:
- variables:
light: !input light
command: "{{ trigger.event.data.command }}"
cluster_id: "{{ trigger.event.data.cluster_id }}"
endpoint_id: "{{ trigger.event.data.endpoint_id }}"
args: "{{ trigger.event.data.args }}"
- choose:
- condition:
- and:
- "{{ command == 'on_press' }}"
- "{{ is_state(light, 'off') }}"
sequence:
- service: light.turn_on
target: !input "light"
data:
transition: 1
brightness_pct: !input "brightness"
- conditions:
- "{{ command == 'off_with_effect' }}"
sequence:
- service: light.turn_off
target: !input "light"
data:
transition: 1
- conditions:
- "{{ command == 'step' }}"
- "{{ args == [0, 30, 9] }}"
sequence:
- service: light.turn_on
target: !input "light"
data:
brightness_step_pct: 10
transition: 1
- conditions:
- "{{ command == 'step' }}"
- "{{ args == [0, 63, 9] }}"
sequence:
- service: light.turn_on
target: !input "light"
data:
brightness_step_pct: 25
transition: 1
- conditions:
- "{{ command == 'up_press' }}"
sequence:
- service: light.turn_on
target: !input "light"
data:
brightness_step_pct: 10
transition: 1
- conditions:
- "{{ command == 'step' }}"
- "{{ args == [1, 30, 9] }}"
sequence:
- service: light.turn_on
target: !input "light"
data:
brightness_step_pct: -10
transition: 1
- conditions:
- "{{ command == 'step' }}"
- "{{ args == [1, 63, 9] }}"
sequence:
- service: light.turn_on
target: !input "light"
data:
brightness_step_pct: -25
transition: 1
- conditions:
- "{{ command == 'down_press' }}"
sequence:
- service: light.turn_on
target: !input "light"
data:
brightness_step_pct: -10
transition: 1