Last active
July 20, 2024 20:52
-
-
Save aschamberger/aa23a4dbc17068649dfde2bb628b9d9b to your computer and use it in GitHub Desktop.
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 - control of Zigbee lights | |
| description: Control Home Assistant Zigbee Light entities from KNX. | |
| homeassistant: | |
| # `knx.telegram` trigger and `enabled` templates require Home Assistant 2024.6.0 | |
| min_version: "2024.6.0" | |
| domain: automation | |
| input: | |
| target_light: | |
| name: Light | |
| description: The light that shall be controled. | |
| selector: | |
| entity: | |
| domain: light | |
| switch_address: | |
| name: Switch group address. | |
| description: > | |
| Group address for switching the lights on and off (DPT 1) | |
| Example: '1/1/1' | |
| default: null | |
| dimm_address: | |
| name: Relative dimming address. | |
| description: > | |
| Group address for dimming the lights (DPT 3.007). | |
| Example: '1/2/1' | |
| default: null | |
| dimm_address_absolute: | |
| name: Absolute dimming address | |
| description: > | |
| Group address for absolute dimming the lights (DPT 5.001). | |
| Example: '1/3/1' | |
| default: null | |
| switch_state_address: | |
| name: Switch state group address | |
| description: > | |
| Group address for lights state (DPT 1). | |
| Example: '1/4/1' | |
| default: null | |
| dimm_state_address: | |
| name: Dimming state address. | |
| description: > | |
| Group address for absolute dimming the lights (DPT 5.001). | |
| Example: '1/5/1' | |
| default: null | |
| color_temp_state_address: | |
| name: Color temp state address. | |
| description: > | |
| Group address for color temp state (DPT 7.600). | |
| Example: '1/6/1' | |
| default: null | |
| color_temp_address: | |
| name: Color temp address. | |
| description: > | |
| Group address for setting color temp (DPT 7.600). | |
| Example: '1/7/1' | |
| default: null | |
| dimm_time: | |
| name: Dimm time | |
| description: Time dimming from 0 to 100% shall take. | |
| selector: | |
| number: | |
| min: 1 | |
| max: 20 | |
| step: 0.1 | |
| unit_of_measurement: seconds | |
| mode: slider | |
| default: 4 | |
| dimm_steps: | |
| name: Dimm steps | |
| description: Steps used to dimm from 0 to 100%. | |
| selector: | |
| number: | |
| min: 1 | |
| max: 100 | |
| step: 1 | |
| unit_of_measurement: steps | |
| mode: slider | |
| default: 20 | |
| default_brightness: | |
| name: Default brightness | |
| description: Brightness for light on. | |
| selector: | |
| number: | |
| min: 1 | |
| max: 100 | |
| step: 1 | |
| unit_of_measurement: "%" | |
| mode: slider | |
| default: 75 | |
| default_color_temp: | |
| name: Default color temp | |
| description: Color temperature for light on. | |
| selector: | |
| number: | |
| min: 2000 | |
| max: 7500 | |
| step: 1 | |
| unit_of_measurement: "K" | |
| mode: box | |
| default: 3000 | |
| source_url: https://gist.github.com/aschamberger/aa23a4dbc17068649dfde2bb628b9d9b | |
| # no matched condition stops repeat sequence to stop dimming (dimm 0) | |
| mode: restart | |
| max_exceeded: silent | |
| variables: | |
| _dimm_time: !input dimm_time | |
| _dimm_steps: !input dimm_steps | |
| dimm_time: "{{ _dimm_time|float }}" | |
| dimm_steps: "{{ _dimm_steps|int }}" | |
| dimm_step: "{{ (255 / dimm_steps) | round(0, 'ceil') }}" | |
| dimm_delay: "{{ dimm_time * 1000 / dimm_steps }}" | |
| trigger_variables: | |
| _switch_address: !input switch_address | |
| _dimm_address: !input dimm_address | |
| _dimm_address_absolute: !input dimm_address_absolute | |
| _switch_state_address: !input switch_state_address | |
| _dimm_state_address: !input dimm_state_address | |
| _color_temp_state_address: !input color_temp_state_address | |
| _color_temp_address: !input color_temp_address | |
| trigger: | |
| - platform: homeassistant | |
| event: start | |
| id: "initialize" | |
| - platform: event | |
| event_type: automation_reloaded | |
| id: "initialize" | |
| # when KNX integration was reloaded | |
| - platform: event | |
| event_type: service_registered | |
| event_data: | |
| domain: knx | |
| service: event_register | |
| id: "initialize" | |
| - 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 }}" | |
| - platform: knx.telegram | |
| destination: !input dimm_address_absolute | |
| type: percent | |
| group_value_read: false | |
| group_value_response: false | |
| id: "dimm_absolute" | |
| enabled: "{{ _dimm_address_absolute != None }}" | |
| - platform: knx.telegram | |
| destination: !input color_temp_address | |
| type: color_temperature | |
| group_value_read: false | |
| group_value_response: false | |
| id: "color_temp" | |
| enabled: "{{ _color_temp_address != None }}" | |
| action: | |
| - choose: | |
| # TURN ON | |
| - conditions: | |
| condition: and | |
| conditions: | |
| - condition: trigger | |
| id: "switch" | |
| - "{{ trigger.payload == 1 }}" | |
| sequence: | |
| - service: light.turn_on | |
| entity_id: !input target_light | |
| data: | |
| color_temp_kelvin: !input default_color_temp | |
| brightness_pct: !input default_brightness | |
| # TURN OFF | |
| - conditions: | |
| condition: and | |
| conditions: | |
| - condition: trigger | |
| id: "switch" | |
| - "{{ trigger.payload == 0 }}" | |
| sequence: | |
| - service: light.turn_off | |
| entity_id: !input target_light | |
| # DIMM UP | |
| - conditions: | |
| condition: and | |
| conditions: | |
| - condition: trigger | |
| id: "dimm" | |
| - "{{ 9 <= trigger.payload <= 15 }}" | |
| sequence: | |
| - repeat: | |
| count: '{{ dimm_steps }}' | |
| sequence: | |
| - service: light.turn_on | |
| entity_id: !input target_light | |
| data: | |
| brightness_step: '{{ dimm_step }}' | |
| - delay: | |
| milliseconds: '{{ dimm_delay }}' | |
| # DIMM DOWN | |
| - conditions: | |
| condition: and | |
| conditions: | |
| - condition: trigger | |
| id: "dimm" | |
| - "{{ 1 <= trigger.payload <= 7 }}" | |
| sequence: | |
| - repeat: | |
| count: '{{ dimm_steps }}' | |
| sequence: | |
| - service: light.turn_on | |
| entity_id: !input target_light | |
| data: | |
| brightness_step: '{{ -dimm_step }}' | |
| - delay: | |
| milliseconds: '{{ dimm_delay }}' | |
| # DIMM ABSOLUTE | |
| - conditions: | |
| condition: and | |
| conditions: | |
| - condition: trigger | |
| id: "dimm_absolute" | |
| sequence: | |
| - service: light.turn_on | |
| entity_id: !input target_light | |
| data: | |
| brightness_pct: '{{ trigger.value }}' | |
| # SET COLOR TEMP | |
| - conditions: | |
| condition: and | |
| conditions: | |
| - condition: trigger | |
| id: "color_temp" | |
| sequence: | |
| - service: light.turn_on | |
| entity_id: !input target_light | |
| data: | |
| color_temp_kelvin: '{{ trigger.value | int(default=3000) }}' | |
| # INITIALIZE | |
| - conditions: | |
| condition: trigger | |
| id: "initialize" | |
| sequence: | |
| - sequence: | |
| - condition: template | |
| value_template: '{{ True }}' | |
| enabled: "{{ _switch_state_address != None }}" | |
| - service: knx.exposure_register | |
| data: | |
| address: !input switch_state_address | |
| entity_id: !input target_light | |
| type: binary | |
| default: false | |
| - sequence: | |
| - condition: template | |
| value_template: '{{ True }}' | |
| enabled: "{{ _dimm_state_address != None }}" | |
| - service: knx.exposure_register | |
| data: | |
| address: !input dimm_state_address | |
| entity_id: !input target_light | |
| attribute: brightness | |
| type: percent | |
| default: 0 | |
| - sequence: | |
| - condition: template | |
| value_template: '{{ True }}' | |
| enabled: "{{ _color_temp_state_address != None }}" | |
| - service: knx.exposure_register | |
| data: | |
| address: !input color_temp_state_address | |
| entity_id: !input target_light | |
| attribute: color_temp_kelvin | |
| type: color_temperature | |
| default: 3000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment