Read KNX telegrams

It’s a node-red knx integration, this is listening the knx bus trough the “T 13 AB” node, and when a telegram is fired tells HA to call a service “light:turn on/off”

There is some info on knx-ha automations here, in this Jypsy mentions how to control a knx light:

knx: 

switch:
- platform: knx
  # The normal on/off switch for the light
  name: "Licht, Eltern Bett"
  address: '1/2/12'
- platform: knx
  # The switch that triggers the dim script
  # This switch must be configured in ETS to send on when pressed and off when released
  name: "Licht, Eltern Bett, Fadeout"
  address: '1/2/17'

light:
  # This is the light that we want to dim (more precisely it is the dimming actuator of the light).
  # It is directly controlled through the first switch above.
  # (Note that the switch shares its group address with this light and thus controls it over the KNX bus.)
  - platform: knx
    name: 'Eltern Bett'
    address: '1/2/12'
    state_address: '1/2/15'
    brightness_address: '1/2/13'
    brightness_state_address: '1/2/16' 

automation:
# start the dim script, if the dim switch is pressed
- id: light_eltern_bett_fadeout
  alias: Licht Eltern Bett Fade-Out
  trigger:
  - entity_id: switch.licht_eltern_bett_fadeout
    platform: state
    to: 'on'
  condition: []
  action:
  # in case the script was already running, we first stop it
  - service: script.turn_off
    entity_id: script.light_eltern_bett_fadeout
  - service: script.turn_on
    entity_id: script.light_eltern_bett_fadeout

# stop the dim script, if light is switched manually
- id: light_eltern_bett_fadeout_stop
  alias: Licht Eltern Bett Fade-Out STOP
  trigger:
  - entity_id: switch.licht_eltern_bett
    platform: state
    # no argument here = trigger with ANY state change
  condition: []
  action:
  - service: script.turn_off
    entity_id: script.light_eltern_bett_fadeout

script:
  light_eltern_bett_fadeout:
    alias: Licht Eltern Bett Fade-Out
    sequence:
      - service: light.turn_on
        entity_id: light.eltern_bett
        data:
          brightness_pct: 80
      - delay: '00:01:00'
      - service: light.turn_on
        entity_id: light.eltern_bett
        data:
          brightness_pct: 60
      - delay: '00:01:00'
      - service: light.turn_on
        entity_id: light.eltern_bett
        data:
          brightness_pct: 40
      - delay: '00:01:00'
      - service: light.turn_on
        entity_id: light.eltern_bett
        data:
          brightness_pct: 20
      - delay: '00:01:00'
      - service: light.turn_on
        entity_id: light.eltern_bett
        data:
          brightness_pct: 10
      - delay: '00:01:00'
      - service: light.turn_off
        entity_id: light.eltern_bett

or hue light:

knx: 

sensor:
  - platform: knx
    name: "Licht, Couch DimAbs"
    state_address: '1/1/52'
    type: "percent"    
  - platform: knx
    name: "Licht, Couch FarbTemp"
    state_address: '1/1/54'
    type: "percent"

automation:
# handle brightness values > 0
- id: light_knx_to_hue_couch_percent
  alias: Licht Couch KNX an Hue PROZENT
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id: sensor.licht_couch_dimabs
  condition:
  - condition: template
    value_template: '{{ (float(trigger.to_state.state) > 0) }}'
  action:
  # turn on / set brightness for the Hue bulbs
  - service: light.turn_on
    data_template:
      entity_id: light.hue_couch_1, light.hue_couch_2, light.hue_couch_3
      brightness: '{{ (float(trigger.to_state.state) * 255 / 100) | round(0) }}'
  # turn on the Osram on-off-plug
  - service: light.turn_on
    entity_id: light.steckdosenschalter_couch

# handle brightness value == 0  (which means OFF)
- id: light_knx_to_hue_couch_percent_off
  alias: Licht Couch KNX an Hue PROZENT AUS
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id: sensor.licht_couch_dimabs
    to: '0'
  condition:
  action:
  - service: light.turn_off
    entity_id: light.hue_couch_1, light.hue_couch_2, light.hue_couch_3, light.steckdosenschalter_couch

# Handle color temp values
- id: light_knx_to_hue_couch_color
  alias: Licht Couch KNX an Hue FARBE
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id: sensor.licht_couch_farbtemp
  condition:
  action:
  - service: light.turn_on
    data_template:
      entity_id: light.hue_couch_1, light.hue_couch_2, light.hue_couch_3
      # Do some math to convert 0...100% into the min/medium/max color temperature of your bulbs.
      # The color temperature is defined in Mireds instead of Kelvin (Mired = 1,000,000 / Kelvin).
      # The lowest and highest available Mired value is read from the attributes of one of the bulbs, 
      # so this works with Hue as well as Trådfri. 
      color_temp: '{{ ((1 - float(trigger.to_state.state) / 100) * (states.light.hue_couch_1.attributes.max_mireds - states.light.hue_couch_1.attributes.min_mireds) + states.light.hue_couch_1.attributes.min_mireds) | round(0) }}'

I believe that the problems for me are:

A) I don’t have knx dimmer actuators and,
B) The switches that he is using have more in-built logic, so they can send an absolute value in %.

Because of that I believe that python’s for or while loops would be a good solution generate this logic…