How to control GPIO port automatically from KNX sensor?

Hello! I need help to set up my hassio to automatically switch off a relay connected to GPIO Raspberry pi 2 when KNX binary sensor value is 1. I have configured the KNX binary sensor, and this is working. Can someone help me with code to automate this? Code for KNX binary sensor in my configuration.yaml:

binary_sensor:
  - platform: knx
    name: Waterguard
    address: '3/1/4'

Thank you.

Have you seen this:

Yes. Have added this in the config:

switch:
  - platform: rpi_gpio
    ports:
      17: waterguard.rele
    invert_logic: true

I have not connected the relay yet, but the switch appeared in the UI. The invert_logic should make the relay turn off when switch is turned on. But How should the automation config look? Something like this? :

automation:
  alias: turn off waterguard when home
  initial_state: True
  hide_entity: False
  trigger:
    platform: knx
    entity_id: Waterguard
    to: on
 action:
    service: switch.turn_on
    entity_id: waterguard.rele

Cant get the config to work. Config is checked valid, but not working. Now my config looks like this:

---
action: 
   entity_id: waterguard.rele
  service: switch.turn_on
alias: "Turn off waterguard when home"
hide_entity: false
trigger: 
  entity_id: binary_sensor.Waterguard
  platform: state
  from: false
  to: true

Fails when restarting: “Invalid config. The following components and platforms could not be set up: automation”

Log: ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: expected str for dictionary value @ data[‘trigger’][0][‘from’]. Got None
expected str for dictionary value @ data[‘trigger’][0][‘to’]. Got None.