From eecac86657c3125d4de6282d5d1d5f8145b69953 Mon Sep 17 00:00:00 2001
From: Pavel Kachalouski
Date: Mon, 2 Dec 2024 18:46:12 +0100
Subject: [PATCH] Simplify philips_zigbee_dial.yaml
---
philips_zigbee_dial.yaml | 96 ++++++++++------------------------------
1 file changed, 24 insertions(+), 72 deletions(-)
diff --git a/philips_zigbee_dial.yaml b/philips_zigbee_dial.yaml
index f4bdae6..5b6671d 100644
--- a/philips_zigbee_dial.yaml
+++ b/philips_zigbee_dial.yaml
@@ -58,23 +58,25 @@ blueprint:
source_url: https://github.com/xeppaka/ha-automations/blob/main/philips_zigbee_dial.yaml
mode: restart
max_exceeded: silent
+
variables:
first_light: !input "first_light"
second_light: !input "second_light"
third_light: !input "third_light"
forth_light: !input "forth_light"
- current_light: !input "current_light"
dim_scale: !input "dim_scale"
lights:
first_light: !input "first_light"
second_light: !input "second_light"
third_light: !input "third_light"
forth_light: !input "forth_light"
+
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input "remote"
+
action:
- variables:
command: "{{ trigger.event.data.command }}"
@@ -90,11 +92,6 @@ action:
sequence:
- service: homeassistant.toggle
target: !input "first_light"
- - service: input_text.set_value
- target:
- entity_id: !input "current_light"
- data:
- value: first_light
- conditions:
- "{{ command == 'recall' }}"
- "{{ second_light != none }}"
@@ -102,77 +99,32 @@ action:
sequence:
- service: homeassistant.toggle
target: !input "second_light"
- - choose:
- - conditions: "{{ current_light != none }}"
- sequence:
- - service: input_text.set_value
- target:
- entity_id: !input "current_light"
- data:
- value: second_light
- - conditions:
- - "{{ command == 'recall' }}"
- - "{{ third_light != none }}"
- - "{{ 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:
+ # - "{{ command == 'recall' }}"
+ # - "{{ third_light != none }}"
+ # - "{{ scene == 5 }}"
+ # sequence:
+ # - service: homeassistant.toggle
+ # target: !input "third_light"
+ # - conditions:
+ # - "{{ command == 'recall' }}"
+ # - "{{ forth_light != none }}"
+ # - "{{ scene == 4 }}"
- conditions:
- "{{ command == 'step_with_on_off' }}"
- "{{ step_mode == 'StepMode.Up' }}"
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
- target: !input "first_light"
- data:
- brightness_step_pct: "{{ step_size * dim_scale }}"
- transition: 1
+ - service: light.turn_on
+ target: !input "first_light"
+ data:
+ brightness_step_pct: "{{ step_size * dim_scale }}"
+ transition: 1
- conditions:
- "{{ command == 'step_with_on_off' }}"
- "{{ step_mode == 'StepMode.Down' }}"
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
- target: !input "first_light"
- data:
- brightness_step_pct: "{{ -step_size * dim_scale }}"
- transition: 1
+ - service: light.turn_on
+ target: !input "first_light"
+ data:
+ brightness_step_pct: "{{ -step_size * dim_scale }}"
+ transition: 1