HA, Velux KLF 200 and KNX

Hey,
in my new house i must install Somfy iO-shutters, i was given no choice :man_facepalming:

I connect them with a KLF200 an now i can control them via HA.

Now i want to control the covers with a KNX-Switch.

And now is the question, how can i realize that?

I installed the KNX-Integration and HA ist talking to the KNX-Bus and the KNX-Bus is talking to HA.

But now I don’t know what to do next? :worried:
Can i solve it with a yaml.file or an automation?

I would really be very happy if you could help me :heart:

Greetings

That’s how the shutters / covers will be defined :point_up_2:

Hi :wave:!
You can do that with an automation using a device trigger (KNX Interface device) (or a knx_event event) with the Group address and payload you like to call the cover.open_cover or cover.close_cover service (or maybe a they have device actions, I don’t know).

Here would be a blueprint for that Cover Blueprint how to make destination in KNX work with appended text? and here is another example using knx_event KNX: Expose cover to KNX - #4 by jogie

Thanks for your fast reply @farmio :heart:

Oh that’s very difficult for me, i’m new @HA :worried:
I tried NodeRed, iOBroker and so on, but i with HA i’m feeling good at the moment and i’m in good spirits that it will work with the KNX-Switch :blush:

From the second link:

I have to put this in a knx.yaml:

knx:
  event:
  - address:
    - "0/4/20" # GA for cover going up / down or stop
  expose:
    - type: percent
      entity_id: sensor.cover_04_31_rolladen_fensterlinks_position_invert
      address: "0/4/21" # GA for cover state
      default: 0

This in the automations.yaml:

- id: 'automation.04_rollo_links_ab'
  alias: Steuere Keller Rollo Fenster links
  description: ''
  trigger:
  - platform: event
    event_type: knx_event
    event_data: {}
    condition:
    - condition: template
      value_template: '{{ trigger.event.data.destination == ''0/4/20'' and trigger.event.data.data == 1 }}'
    action:
    - service: cover.stop_cover
      data: {}
      target:
        entity_id: cover.04_31_rolladen_fensterlinks
    - service: cover.close_cover
      data: {}
      target:
        entity_id: cover.04_31_rolladen_fensterlinks
  mode: single
- id: 'automation.04_rollo_links_auf'
  alias: Steuere Keller Rollo Fenster links
  description: ''
  trigger:
  - platform: event
    event_type: knx_event
    event_data: {}
    condition:
    - condition: template
      value_template: '{{ trigger.event.data.destination == ''0/4/20'' and trigger.event.data.data == 0 }}'
      action:
      - service: cover.stop_cover
        data: {}
        target:
          entity_id: cover.04_31_rolladen_fensterlinks
    - service: cover.open_cover
      data: {}
      target:
        entity_id: cover.04_31_rolladen_fensterlinks
  mode: single

And where i have to put this?

 - sensor:
  - name: cover_04_31_rolladen_fensterlinks_position_invert
state: "{{ 100 - (state_attr('cover.04_31_rolladen_fensterlinks', 'current_position') | int) }}"

Thanks in advance :slight_smile:

That’s a template sensor. You can configure these from the UI nowadays. See Open your Home Assistant instance and show your helper entities.

Hey @farmio,
i got these errors, also if i put in my GA’s and entity_id’s :worried:

These are indentation errors. Remove 2 whitespaces.
Or do the tests in the triggers event_data, instead of adding a condition.

Or, better yet, use the UI automation builder.

I tried it with the UI automation builder but nothing happend :worried:
If i execute the automation from the UI, the shutter move down. But if i push the button on the switch, nothing happend :worried:

This is my automation with UI automation builder:

alias: Neue Automatisierung
description: ""
trigger:
  - platform: device
    domain: knx
    device_id: c1b43dda4aa46bdf782d5c3d388476b1
    type: telegram
    destination:
      - 1/6/10
condition: []
action:
  - service: cover.close_cover
    data: {}
    target:
      entity_id: cover.kind_2_links
mode: single

And if i put the switch, this will be shown in KNX-Group Monitor, but the shutter doesn’t move :worried:

this looks fine. Have a look at the automation debugger - maybe you’ll find something there.
Or the logs…

Heyho @farmio,
i made it with:

knx.yaml:

event:
  - address:
      - "1/6/10" # GA for cover going up / down or stop
expose:
  - type: percent
    entity_id: sensor.cover_04_31_rolladen_fensterlinks_position_invert
    address: "1/6/11" # GA for cover state
    default: 0

and automations.yaml:

- id: "automation.04_rollo_kind 2_links_ab"
  alias: Steuere Kind 2 Rollo Fenster links
  description: ""
  trigger:
    - platform: event
      event_type: knx_event
      event_data: {}
  condition:
    - condition: template
      value_template: "{{ trigger.event.data.destination == '1/6/10' and trigger.event.data.data== 1 }}"
  action:
    - service: cover.stop_cover
      data: {}
      target:
        entity_id: cover.kind_2_links
    - service: cover.close_cover
      data: {}
      target:
        entity_id: cover.kind_2_links
  mode: single
- id: "automation.04_rollo_links_auf"
  alias: Steuere Keller Rollo Fenster links
  description: ""
  trigger:
    - platform: event
      event_type: knx_event
      event_data: {}
  condition:
    - condition: template
      value_template: "{{ trigger.event.data.destination == '1/6/10' and trigger.event.data.data== 0 }}"
  action:
    - service: cover.stop_cover
      data: {}
      target:
        entity_id: cover.kind_2_links
    - service: cover.open_cover
      data: {}
      target:
        entity_id: cover.kind_2_links
  mode: single

Now my shutters went up and down :heart_eyes: :heart_eyes:

But how can i stop them, if i push the switch again. At the Moment they only went completely up or completely down?

And for the Status / Sensor, what do I have to choose here? :man_shrugging:

Hey @farmio,
i’m sure you just missed it :relaxed:

Can you please help me with the “Stop-Function” and the Status / Sensor?

Thank you very much in advance :pray:

Sorry, I can’t help you there. You’ll have to try what works best with your specific switches and shutters.

For the status, I don’t know what you are trying to accomplish.

Hey @udgesbou,

this threat and the answers from @farmio helped me by getting my KLF 200 to work with my KNX switches. And i got the stop funcionality to work to.

For my shutters i have these four adresses in my knx.yaml:

cover:
  - name: "Shutter 1"
    move_long_address: "1/0/1"
    move_short_address: "1/0/2"
    position_address: "1/0/3"
    position_state_address: "1/0/4"

What i had to do is to add both “move” addresses to the event block:

event:
  - address:
    - "1/0/2" # GA for cover going up / down
    - "1/0/1" # GA for cover stop

For my automation i used the code from this blueprint:

- alias: KNX-Velux-Bridge_Shutter_1
  description: "KNX to Velux Brindge"
  trigger:
    - platform: event
      event_type: knx_event
      event_data:
        destination: 1/0/2
        data: 0
      id: Open
    - platform: event
      event_type: knx_event
      event_data:
        destination: 1/0/2
        data: 1
      id: Close
    - platform: event
      event_type: knx_event
      event_data:
        destination: 1/0/1
      id: Stop
    - platform: event
      event_type: knx_event
      event_data:
        destination: 1/0/3
      id: Percentage 
  condition: []
  action:
    - choose:
        - conditions:
            - condition: trigger
              id: Open
          sequence:
            - service: cover.open_cover
              data: {}
              target:
                entity_id: cover.shutter_1
        - conditions:
            - condition: trigger
              id: Close
          sequence:
            - service: cover.close_cover
              data: {}
              target:
                entity_id: cover.shutter_1
        - conditions:
            - condition: trigger
              id: Stop
          sequence:
            - service: cover.stop_cover
              data: {}
              target:
                entity_id: cover.shutter_1
        - conditions:
            - condition: trigger
              id: Percentage
          sequence:
            - service: cover.set_cover_position
              data:
                position: "{{ trigger.event.data.value }}"
              target:
                entity_id: cover.shutter_1

Now, when i hold the “button” on my MDT Glastaster for a “long” second, the move_long_address: "1/0/1" is used and cover.stop_cover is triggert.

What is still not working is cover.set_cover_position. This is not an option when using the MDT Glastaster, but i would like to just use the KNX entities on my dashboard and not have a mix of KNX and Velux entities.
On the dashboard you can use the slider to set a position. Right now the value is sent via the bus, but not picked up again to set this value via the KLF 200. I have to try some more.

I hope this helps.

Greetings