Hörmann KNX Interface and Button Template

Hi guys!
I’m trying to set up my KNX garage door in HA. I integrated the door as different switches and sensors and as well as a cover entity. I have a Button in my Lovelace and I want that the Garagedoor opens or closes if I hit the button. As there is no explicit “start” command, instead there are separate commands for open / close, I tried to send a 1 or 0 as payload dependent on to state of the door.

This works:

tap_action:
  action: call-service
  service: knx.send
  service_data:
    address: 30/3/1
    payload: '1'

or vice versa payload: ‘0’

but what doesn’t work is:

tap_action:
  action: call-service
  service: knx.send
  service_data:
    address: 30/3/1
    payload: |
      {% if states('sensor.garagentorantrieb_ug_status_prozent') == '0' %}
        '1'
      {% else %}
        '0'
      {% endif %}

In this case I get an error: required key not provided @data[‘type’]

Any Ideas?

Okay figured it out by myself. It has to be a java Template, not a Jinja Template due to the custom button card. Now it works. Maybe aweful solution but works :slight_smile:

Here is the complete Card :slight_smile:

type: custom:button-card
entity: switch.kellerlicht
icon: mdi:lightbulb-group
name: Kellerlicht
show_last_changed: true
show_label: false
double_tap_action:
  action: more-info
state:
  - value: 'off'
    styles:
      card:
        - filter: opacity(50%)
      icon:
        - filter: grayscale(100%)
  - value: 'on'
    color: yellow
styles:
  label:
    - color: gray
    - font-size: 12px
  grid:
    - grid-template-areas: '"i" "n" "s" "l"'
    - grid-template-columns: 1fr
    - grid-template-rows: 1fr min-content min-content
  img_cell:
    - align-self: center
    - text-align: center
  name:
    - justify-self: center
    - font-weight: bold
    - font-size: 12px
  state:
    - justify-self: start
    - padding-left: 10px

Hi :wave:!
Why don’t you use a Knx cover entity? AFAIK Hörmann gateway even provides a status object (%).

Hello Matthias,
because it has to fit in this grid :slight_smile:

I use the status object for the second line. Have a template in place. If status 100% it shows Closed, if its something between 1-99% it shows the exact percentage and if it’s 0 it shows open :slight_smile: