Forked from farmio/knx-relative-dimming-for-lights.yaml
Last active
November 8, 2024 10:12
-
-
Save hameno/e4313dafcb8a7cb67dc3c4b3576a8a2f to your computer and use it in GitHub Desktop.
KNX - relative dimming for lights blueprint
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: KNX - relative dimming for lights | |
description: Control Home Assistant light entities from KNX switching and relative dimming (DPT 3.007) telegrams. | |
homeassistant: | |
# `knx.telegram` trigger and `enabled` templates require Home Assistant 2024.6.0 | |
min_version: "2024.6.0" | |
domain: automation | |
input: | |
target_lights: | |
name: Light | |
description: The lights that shall be controled. | |
selector: | |
target: | |
entity: | |
domain: light | |
switch_address: | |
name: Switch group address | |
description: > | |
Group address for switching the lights on and off. DPT 1 | |
Example: '1/2/3' | |
default: null | |
dimm_address: | |
name: Relative dimming address | |
description: > | |
Group address for dimming the lights. DPT 3.007 | |
Example: '1/2/4' | |
default: null | |
# no matched condition stops repeat sequence to stop dimming (dimm 0) | |
mode: queued | |
max: 10 | |
max_exceeded: silent | |
trigger_variables: | |
_switch_address: !input switch_address | |
_dimm_address: !input dimm_address | |
trigger: | |
- platform: knx.telegram | |
destination: !input switch_address | |
group_value_read: false | |
group_value_response: false | |
id: "switch" | |
enabled: "{{ _switch_address != None }}" | |
- platform: knx.telegram | |
destination: !input dimm_address | |
group_value_read: false | |
group_value_response: false | |
id: "dimm" | |
enabled: "{{ _dimm_address != None }}" | |
action: | |
- choose: | |
# TURN ON | |
- alias: Turn on | |
conditions: | |
condition: and | |
conditions: | |
- condition: trigger | |
id: "switch" | |
- "{{ trigger.payload == 1 }}" | |
sequence: | |
- service: light.turn_on | |
target: !input target_lights | |
# TURN OFF | |
- alias: Turn off | |
conditions: | |
condition: and | |
conditions: | |
- condition: trigger | |
id: "switch" | |
- "{{ trigger.payload == 0 }}" | |
sequence: | |
- service: light.turn_off | |
target: !input target_lights | |
# DIMM UP | |
- alias: Dimm up by 12,5% | |
conditions: | |
condition: and | |
conditions: | |
- condition: trigger | |
id: "dimm" | |
- "{{ trigger.payload == 12 }}" | |
sequence: | |
- service: light.turn_on | |
target: !input target_lights | |
data: | |
brightness_step_pct: +12.5 | |
- alias: Dimm up by 25% | |
conditions: | |
condition: and | |
conditions: | |
- condition: trigger | |
id: "dimm" | |
- "{{ trigger.payload == 11 }}" | |
sequence: | |
- service: light.turn_on | |
target: !input target_lights | |
data: | |
brightness_step_pct: +25 | |
- alias: Dimm up by 50% | |
conditions: | |
condition: and | |
conditions: | |
- condition: trigger | |
id: "dimm" | |
- "{{ trigger.payload == 10 }}" | |
sequence: | |
- service: light.turn_on | |
target: !input target_lights | |
data: | |
brightness_step_pct: +50 | |
# DIMM DOWN | |
- alias: Dimm down by 12.5% | |
conditions: | |
condition: and | |
conditions: | |
- condition: trigger | |
id: "dimm" | |
- "{{ trigger.payload == 4 }}" | |
sequence: | |
- service: light.turn_on | |
target: !input target_lights | |
data: | |
brightness_step_pct: -12.5 | |
- alias: Dimm down by 25% | |
conditions: | |
condition: and | |
conditions: | |
- condition: trigger | |
id: "dimm" | |
- "{{ trigger.payload == 3 }}" | |
sequence: | |
- service: light.turn_on | |
target: !input target_lights | |
data: | |
brightness_step_pct: -25 | |
- alias: Dimm down by 50% | |
conditions: | |
condition: and | |
conditions: | |
- condition: trigger | |
id: "dimm" | |
- "{{ trigger.payload == 2 }}" | |
sequence: | |
- service: light.turn_on | |
target: !input target_lights | |
data: | |
brightness_step_pct: -50 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment