Skip to content

Instantly share code, notes, and snippets.

@somdoron
Last active March 25, 2023 11:59
Show Gist options
  • Save somdoron/d10760400c2d1b70e1d51d16b5477268 to your computer and use it in GitHub Desktop.
Save somdoron/d10760400c2d1b70e1d51d16b5477268 to your computer and use it in GitHub Desktop.
blueprint:
name: KNX - Light Actuator
description: Controll Home Assistant Light entities from KNX switches.
domain: automation
input:
target_light:
name: Light
description: The light that shall be controled.
selector:
target:
entity:
domain: light
feedback_light:
name: Feedback Light
description: The light to report back to the switch
selector:
entity:
domain: light
switch_address:
name: Switch group address
description: >
Group address for switching the lights on and off.
Example: '1/2/3'
switch_address_feedback:
name: Switch address to report feedback
description: >
Group address for feedback on status of the light.
Example: '1/2/3'
# no matched condition stops repeat sequence to stop dimming (dimm 0)
mode: restart
max_exceeded: silent
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: event
event_type: knx_event
event_data:
destination: !input switch_address
telegramtype: GroupValueWrite
id: "switch"
action:
- choose:
# TURN ON
- conditions:
condition: and
conditions:
- condition: trigger
id: "switch"
- "{{ trigger.event.data.data == 1 }}"
sequence:
- service: light.turn_on
target: !input target_light
# TURN OFF
- conditions:
condition: and
conditions:
- condition: trigger
id: "switch"
- "{{ trigger.event.data.data == 0 }}"
sequence:
- service: light.turn_off
target: !input target_light
# INITIALIZE
- conditions:
condition: trigger
id: "initialize"
sequence:
- service: knx.event_register
data:
address: !input switch_address
- service: knx.exposure_register
data:
address: !input switch_address_feedback
type: binary
entity_id: !input target_light
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment